diff options
Diffstat (limited to 'src/server/scripts')
354 files changed, 6724 insertions, 5295 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 15a724e69d1..9269bbb07ee 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -22,9 +22,11 @@ Comment: All account related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" #include "AccountMgr.h" #include "Chat.h" +#include "Language.h" +#include "Player.h" +#include "ScriptMgr.h" class account_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp index 7667e79ece7..9f5c861c52f 100644 --- a/src/server/scripts/Commands/cs_achievement.cpp +++ b/src/server/scripts/Commands/cs_achievement.cpp @@ -22,8 +22,10 @@ Comment: All achievement related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" #include "Chat.h" +#include "Language.h" +#include "Player.h" +#include "ScriptMgr.h" class achievement_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp index bfb52d342e1..3d340f3aaea 100644 --- a/src/server/scripts/Commands/cs_ban.cpp +++ b/src/server/scripts/Commands/cs_ban.cpp @@ -22,11 +22,13 @@ Comment: All ban related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "Chat.h" #include "AccountMgr.h" +#include "Chat.h" +#include "Language.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" +#include "Player.h" +#include "ScriptMgr.h" class ban_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_cast.cpp b/src/server/scripts/Commands/cs_cast.cpp index 70cfb8cb830..7539ebd2b0c 100644 --- a/src/server/scripts/Commands/cs_cast.cpp +++ b/src/server/scripts/Commands/cs_cast.cpp @@ -24,6 +24,9 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" +#include "Creature.h" +#include "Language.h" +#include "Player.h" class cast_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 2202edbe4aa..f8db39e0338 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -22,11 +22,13 @@ Comment: All character related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "Chat.h" #include "AccountMgr.h" +#include "Chat.h" #include "ObjectMgr.h" #include "PlayerDump.h" +#include "Player.h" +#include "ReputationMgr.h" +#include "ScriptMgr.h" class character_commandscript : public CommandScript { @@ -238,11 +240,11 @@ public: if (handler->needReportToTarget(player)) { if (oldLevel == newLevel) - ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, handler->GetNameLink().c_str()); + ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, handler->GetNameLink().c_str()); else if (oldLevel < newLevel) - ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, handler->GetNameLink().c_str(), newLevel); + ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_UP, handler->GetNameLink().c_str(), newLevel); else // if (oldlevel > newlevel) - ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, handler->GetNameLink().c_str(), newLevel); + ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, handler->GetNameLink().c_str(), newLevel); } } else diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp index 4f503fdbb76..026177ece6d 100644 --- a/src/server/scripts/Commands/cs_cheat.cpp +++ b/src/server/scripts/Commands/cs_cheat.cpp @@ -22,9 +22,11 @@ Comment: All cheat related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "ObjectMgr.h" #include "Chat.h" +#include "Language.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "ScriptMgr.h" class cheat_commandscript : public CommandScript { @@ -233,7 +235,7 @@ public: chr->SetTaxiCheater(true); handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str()); if (handler->needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str()); + ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str()); return true; } @@ -242,7 +244,7 @@ public: chr->SetTaxiCheater(false); handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str()); if (handler->needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str()); + ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str()); return true; } @@ -271,13 +273,13 @@ public: { handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(chr).c_str()); if (handler->needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str()); + ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str()); } else { handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(chr).c_str()); if (handler->needReportToTarget(chr)) - ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str()); + ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str()); } for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 99ed8cc4301..956d9ac3376 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -31,6 +31,7 @@ EndScriptData */ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "GossipDef.h" +#include "Language.h" #include <fstream> diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index 0bb376b08dd..73ed341a21c 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -22,11 +22,14 @@ Comment: All disable related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "ObjectMgr.h" #include "Chat.h" #include "DisableMgr.h" +#include "Language.h" +#include "ObjectMgr.h" #include "OutdoorPvP.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "SpellMgr.h" class disable_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_event.cpp b/src/server/scripts/Commands/cs_event.cpp index 4f6acd7b629..b0a646b7288 100644 --- a/src/server/scripts/Commands/cs_event.cpp +++ b/src/server/scripts/Commands/cs_event.cpp @@ -22,9 +22,11 @@ Comment: All event related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "GameEventMgr.h" #include "Chat.h" +#include "GameEventMgr.h" +#include "Language.h" +#include "Player.h" +#include "ScriptMgr.h" class event_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 4c6e36d3f71..b46f99eaa8f 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -26,7 +26,10 @@ EndScriptData */ #include "ObjectMgr.h" #include "Chat.h" #include "AccountMgr.h" +#include "Language.h" #include "World.h" +#include "Player.h" +#include "Opcodes.h" class gm_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index f7371884da2..6d75e63d053 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -27,6 +27,8 @@ EndScriptData */ #include "MapManager.h" #include "TicketMgr.h" #include "Chat.h" +#include "Language.h" +#include "Player.h" class go_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 6803354d29b..c9f07c90259 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -28,6 +28,9 @@ EndScriptData */ #include "PoolMgr.h" #include "MapManager.h" #include "Chat.h" +#include "Language.h" +#include "Player.h" +#include "Opcodes.h" class gobject_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp index a453122aef6..73955a6b9b2 100644 --- a/src/server/scripts/Commands/cs_guild.cpp +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -22,11 +22,12 @@ Comment: All guild related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" #include "Chat.h" +#include "Language.h" #include "Guild.h" #include "GuildMgr.h" #include "ObjectAccessor.h" +#include "ScriptMgr.h" class guild_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp index 4edc5f6fea0..c1d9229ccd3 100644 --- a/src/server/scripts/Commands/cs_honor.cpp +++ b/src/server/scripts/Commands/cs_honor.cpp @@ -22,9 +22,11 @@ Comment: All honor related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "ObjectMgr.h" #include "Chat.h" +#include "Language.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "ScriptMgr.h" class honor_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index f51727af2ef..ffd8a5a7cf7 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "InstanceSaveMgr.h" #include "InstanceScript.h" #include "MapManager.h" +#include "Player.h" class instance_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index cfdfc66f991..9c383153d46 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -25,8 +25,11 @@ EndScriptData */ #include "Chat.h" #include "ScriptMgr.h" #include "ObjectMgr.h" +#include "Language.h" #include "SpellMgr.h" #include "SpellInfo.h" +#include "Player.h" +#include "Pet.h" class learn_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp index 5f1ed59176f..c4da37d032c 100644 --- a/src/server/scripts/Commands/cs_lfg.cpp +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -17,8 +17,10 @@ #include "ScriptMgr.h" #include "Chat.h" +#include "Language.h" #include "LFGMgr.h" #include "Group.h" +#include "Player.h" void GetPlayerInfo(ChatHandler* handler, Player* player) { diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 5c16a0963d3..977369d1405 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -25,8 +25,10 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" #include "SpellAuraEffects.h" +#include "Language.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" +#include "Player.h" class list_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 9889b4752c8..c265cd1faa5 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -22,12 +22,15 @@ Comment: All lookup related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "Chat.h" #include "AccountMgr.h" +#include "Chat.h" #include "GameEventMgr.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" +#include "Player.h" +#include "ReputationMgr.h" +#include "ScriptMgr.h" +#include "SpellInfo.h" class lookup_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp index de2fcf26943..30c94442c51 100644 --- a/src/server/scripts/Commands/cs_message.cpp +++ b/src/server/scripts/Commands/cs_message.cpp @@ -25,6 +25,8 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" #include "ChannelMgr.h" +#include "Language.h" +#include "Player.h" class message_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 7e460c7482f..5e54778b14a 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -23,12 +23,16 @@ #include "GridNotifiers.h" #include "Group.h" #include "InstanceSaveMgr.h" +#include "Language.h" #include "MovementGenerator.h" #include "ObjectAccessor.h" +#include "Opcodes.h" #include "SpellAuras.h" #include "TargetedMovementGenerator.h" #include "WeatherMgr.h" #include "ace/INET_Addr.h" +#include "Player.h" +#include "Pet.h" class misc_commandscript : public CommandScript { @@ -495,7 +499,7 @@ public: handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), ""); if (handler->needReportToTarget(target)) - ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); // stop flight if need if (target->isInFlight()) @@ -606,7 +610,7 @@ public: handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), ""); if (handler->needReportToTarget(player)) - ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str()); + ChatHandler(player->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str()); // stop flight if need if (player->isInFlight()) @@ -1804,7 +1808,7 @@ public: int64 muteTime = time(NULL) + notSpeakTime * MINUTE; target->GetSession()->m_muteTime = muteTime; stmt->setInt64(0, muteTime); - ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str()); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str()); } else { @@ -1860,7 +1864,7 @@ public: LoginDatabase.Execute(stmt); if (target) - ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); std::string nameLink = handler->playerLink(targetName); @@ -2137,7 +2141,7 @@ public: handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str()); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str()); return true; } diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index ff74ae83c20..16599e5d892 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -22,9 +22,14 @@ Comment: All modify related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "ObjectMgr.h" #include "Chat.h" +#include "ObjectMgr.h" +#include "Opcodes.h" +#include "Pet.h" +#include "Player.h" +#include "ReputationMgr.h" +#include "ScriptMgr.h" + class modify_commandscript : public CommandScript { @@ -106,7 +111,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_HP, handler->GetNameLink(target).c_str(), hp, hpm); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_HP_CHANGED, handler->GetNameLink().c_str(), hp, hpm); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_HP_CHANGED, handler->GetNameLink().c_str(), hp, hpm); target->SetMaxHealth(hpm); target->SetHealth(hp); @@ -144,7 +149,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_MANA, handler->GetNameLink(target).c_str(), mana, manam); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MANA_CHANGED, handler->GetNameLink().c_str(), mana, manam); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MANA_CHANGED, handler->GetNameLink().c_str(), mana, manam); target->SetMaxPower(POWER_MANA, manam); target->SetPower(POWER_MANA, mana); @@ -193,7 +198,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_ENERGY, handler->GetNameLink(target).c_str(), energy/10, energym/10); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, handler->GetNameLink().c_str(), energy/10, energym/10); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, handler->GetNameLink().c_str(), energy/10, energym/10); target->SetMaxPower(POWER_ENERGY, energym); target->SetPower(POWER_ENERGY, energy); @@ -244,7 +249,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_RAGE, handler->GetNameLink(target).c_str(), rage/10, ragem/10); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, handler->GetNameLink().c_str(), rage/10, ragem/10); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, handler->GetNameLink().c_str(), rage/10, ragem/10); target->SetMaxPower(POWER_RAGE, ragem); target->SetPower(POWER_RAGE, rage); @@ -278,7 +283,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_RUNIC_POWER, handler->GetNameLink(target).c_str(), rune/10, runem/10); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, handler->GetNameLink().c_str(), rune/10, runem/10); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, handler->GetNameLink().c_str(), rune/10, runem/10); target->SetMaxPower(POWER_RUNIC_POWER, runem); target->SetPower(POWER_RUNIC_POWER, rune); @@ -408,7 +413,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, handler->GetNameLink().c_str(), spellflatid, val, mark); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, handler->GetNameLink().c_str(), spellflatid, val, mark); WorldPacket data(SMSG_SET_FLAT_SPELL_MODIFIER, (1+1+2+2)); data << uint8(spellflatid); @@ -504,7 +509,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_ASPEED, ASpeed, targetNameLink.c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, handler->GetNameLink().c_str(), ASpeed); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, handler->GetNameLink().c_str(), ASpeed); target->SetSpeed(MOVE_WALK, ASpeed, true); target->SetSpeed(MOVE_RUN, ASpeed, true); @@ -552,7 +557,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_SPEED, Speed, targetNameLink.c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, handler->GetNameLink().c_str(), Speed); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, handler->GetNameLink().c_str(), Speed); target->SetSpeed(MOVE_RUN, Speed, true); @@ -597,7 +602,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_SWIM_SPEED, Swim, targetNameLink.c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, handler->GetNameLink().c_str(), Swim); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, handler->GetNameLink().c_str(), Swim); target->SetSpeed(MOVE_SWIM, Swim, true); @@ -642,7 +647,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_BACK_SPEED, BSpeed, targetNameLink.c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, handler->GetNameLink().c_str(), BSpeed); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, handler->GetNameLink().c_str(), BSpeed); target->SetSpeed(MOVE_RUN_BACK, BSpeed, true); @@ -678,7 +683,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, handler->GetNameLink().c_str(), FSpeed); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, handler->GetNameLink().c_str(), FSpeed); target->SetSpeed(MOVE_FLIGHT, FSpeed, true); @@ -715,7 +720,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, handler->GetNameLink(player).c_str()); if (handler->needReportToTarget(player)) - (ChatHandler(player)).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale); + ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale); } target->SetObjectScale(Scale); @@ -963,7 +968,7 @@ public: handler->PSendSysMessage(LANG_YOU_GIVE_MOUNT, handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_MOUNT_GIVED, handler->GetNameLink().c_str()); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_MOUNT_GIVED, handler->GetNameLink().c_str()); target->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); target->Mount(mId); @@ -1019,7 +1024,7 @@ public: { handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_ALL_MONEY_GONE, handler->GetNameLink().c_str()); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_ALL_MONEY_GONE, handler->GetNameLink().c_str()); target->SetMoney(0); } @@ -1030,7 +1035,7 @@ public: handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(moneyToAdd), handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), abs(moneyToAdd)); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), abs(moneyToAdd)); target->SetMoney(newmoney); } } @@ -1038,7 +1043,7 @@ public: { handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, moneyToAdd, handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd); if (moneyToAdd >= MAX_MONEY_AMOUNT) target->SetMoney(MAX_MONEY_AMOUNT); @@ -1378,7 +1383,7 @@ public: handler->PSendSysMessage(LANG_YOU_CHANGE_GENDER, handler->GetNameLink(target).c_str(), gender_full); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, handler->GetNameLink().c_str()); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, handler->GetNameLink().c_str()); return true; } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index ba7342caa80..28e0744c29d 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -27,8 +27,11 @@ EndScriptData */ #include "Chat.h" #include "Transport.h" #include "CreatureGroups.h" +#include "Language.h" #include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand #include "CreatureAI.h" +#include "Player.h" +#include "Pet.h" class npc_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index c2ec563b3c7..22d6e0831d6 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -22,9 +22,11 @@ Comment: All quest related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "ObjectMgr.h" #include "Chat.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "ReputationMgr.h" +#include "ScriptMgr.h" class quest_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 25f4c176bfc..c2791c815ad 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -22,22 +22,24 @@ Comment: All reload related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "ObjectMgr.h" -#include "SpellMgr.h" -#include "TicketMgr.h" -#include "MapManager.h" +#include "AchievementMgr.h" +#include "AuctionHouseMgr.h" +#include "Chat.h" #include "CreatureEventAIMgr.h" +#include "CreatureTextMgr.h" #include "DisableMgr.h" +#include "Language.h" #include "LFGMgr.h" -#include "AuctionHouseMgr.h" -#include "CreatureTextMgr.h" -#include "SmartAI.h" +#include "MapManager.h" +#include "ObjectMgr.h" +#include "ScriptMgr.h" #include "SkillDiscovery.h" #include "SkillExtraItems.h" -#include "Chat.h" -#include "WaypointManager.h" +#include "SmartAI.h" +#include "SpellMgr.h" +#include "TicketMgr.h" #include "WardenCheckMgr.h" +#include "WaypointManager.h" class reload_commandscript : public CommandScript { @@ -78,7 +80,6 @@ public: { "config", SEC_ADMINISTRATOR, true, &HandleReloadConfigCommand, "", NULL }, { "creature_text", SEC_ADMINISTRATOR, true, &HandleReloadCreatureText, "", NULL }, { "creature_ai_scripts", SEC_ADMINISTRATOR, true, &HandleReloadEventAIScriptsCommand, "", NULL }, - { "creature_ai_summons", SEC_ADMINISTRATOR, true, &HandleReloadEventAISummonsCommand, "", NULL }, { "creature_ai_texts", SEC_ADMINISTRATOR, true, &HandleReloadEventAITextsCommand, "", NULL }, { "creature_involvedrelation", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestInvRelationsCommand, "", NULL }, { "creature_linked_respawn", SEC_GAMEMASTER, true, &HandleReloadLinkedRespawnCommand, "", NULL }, @@ -276,7 +277,6 @@ public: static bool HandleReloadAllEventAICommand(ChatHandler* handler, const char* /*args*/) { HandleReloadEventAITextsCommand(handler, "a"); - HandleReloadEventAISummonsCommand(handler, "a"); HandleReloadEventAIScriptsCommand(handler, "a"); return true; } @@ -1037,14 +1037,6 @@ public: return true; } - static bool HandleReloadEventAISummonsCommand(ChatHandler* handler, const char* /*args*/) - { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Summons from `creature_ai_summons`..."); - sEventAIMgr->LoadCreatureEventAI_Summons(); - handler->SendGlobalGMSysMessage("DB table `creature_ai_summons` reloaded."); - return true; - } - static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/) { sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`..."); diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 76a4eb5d943..21a22381ae0 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -22,9 +22,13 @@ Comment: All reset related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" +#include "AchievementMgr.h" #include "Chat.h" +#include "Language.h" #include "ObjectAccessor.h" +#include "Player.h" +#include "Pet.h" +#include "ScriptMgr.h" class reset_commandscript : public CommandScript { @@ -168,7 +172,7 @@ public: { target->resetSpells(/* bool myClassOnly */); - ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS); + ChatHandler(target->GetSession()).SendSysMessage(LANG_RESET_SPELLS); if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) handler->PSendSysMessage(LANG_RESET_SPELLS_ONLINE, handler->GetNameLink(target).c_str()); } @@ -220,7 +224,7 @@ public: creature->ToPet()->resetTalents(); owner->ToPlayer()->SendTalentsInfoData(true); - ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS); + ChatHandler(owner->ToPlayer()->GetSession()).SendSysMessage(LANG_RESET_PET_TALENTS); if (!handler->GetSession() || handler->GetSession()->GetPlayer() != owner->ToPlayer()) handler->PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, handler->GetNameLink(owner->ToPlayer()).c_str()); } @@ -236,7 +240,7 @@ public: { target->resetTalents(true); target->SendTalentsInfoData(false); - ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS); + ChatHandler(target->GetSession()).SendSysMessage(LANG_RESET_TALENTS); if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) handler->PSendSysMessage(LANG_RESET_TALENTS_ONLINE, handler->GetNameLink(target).c_str()); diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index db1995ebb6e..bb4f9be5ffe 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -22,11 +22,13 @@ Comment: All server related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" #include "Chat.h" -#include "SystemConfig.h" #include "Config.h" +#include "Language.h" #include "ObjectAccessor.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "SystemConfig.h" class server_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 8f390d17cd4..756bd75387b 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -22,11 +22,13 @@ Comment: All tele related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "ObjectMgr.h" -#include "MapManager.h" #include "Chat.h" #include "Group.h" +#include "Language.h" +#include "MapManager.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "ScriptMgr.h" class tele_commandscript : public CommandScript { @@ -178,7 +180,7 @@ public: handler->PSendSysMessage(LANG_TELEPORTING_TO, chrNameLink.c_str(), "", tele->name.c_str()); if (handler->needReportToTarget(target)) - (ChatHandler(target)).PSendSysMessage(LANG_TELEPORTED_TO_BY, handler->GetNameLink().c_str()); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_TELEPORTED_TO_BY, handler->GetNameLink().c_str()); // stop flight if need if (target->isInFlight()) @@ -274,7 +276,7 @@ public: handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str()); if (handler->needReportToTarget(player)) - (ChatHandler(player)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str()); + ChatHandler(player->GetSession()).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str()); // stop flight if need if (player->isInFlight()) diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index c99931a90fb..c2c5a0909d6 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -22,11 +22,14 @@ Comment: All ticket related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "Chat.h" #include "AccountMgr.h" +#include "Chat.h" +#include "Language.h" #include "ObjectMgr.h" +#include "Opcodes.h" +#include "Player.h" #include "TicketMgr.h" +#include "ScriptMgr.h" class ticket_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp index e1b30d122de..c6e11c930fb 100644 --- a/src/server/scripts/Commands/cs_titles.cpp +++ b/src/server/scripts/Commands/cs_titles.cpp @@ -22,9 +22,11 @@ Comment: All titles related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" -#include "ObjectMgr.h" #include "Chat.h" +#include "Language.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "ScriptMgr.h" class titles_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 10a18c3ed36..c0b2938c156 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -22,10 +22,12 @@ Comment: All wp related commands Category: commandscripts EndScriptData */ -#include "ScriptMgr.h" +#include "Chat.h" +#include "Language.h" #include "ObjectMgr.h" +#include "Player.h" +#include "ScriptMgr.h" #include "WaypointManager.h" -#include "Chat.h" class wp_commandscript : public CommandScript { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 263897edfad..b5283900eb0 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -20,6 +20,8 @@ #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "blackrock_depths.h" +#include "Player.h" +#include "WorldSession.h" //go_shadowforge_brazier class go_shadowforge_brazier : public GameObjectScript diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp index 347aff2ce0b..ecdcb4b0b82 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp @@ -20,6 +20,7 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "blackrock_depths.h" +#include "Player.h" enum Spells { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp index 0d02e4495a5..2c2ae3a79c5 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp @@ -273,7 +273,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -298,7 +298,7 @@ public: return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp index fdb73fe1196..124743174b6 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp @@ -222,7 +222,7 @@ public: } } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp index 8cc42baff8e..359f218cd5c 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" enum Says { diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp index 30638e9edeb..1335f189286 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -26,12 +26,13 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" enum Says { - SAY_GAMESBEGIN_1 = -1469004, - SAY_GAMESBEGIN_2 = -1469005, - SAY_VAEL_INTRO = -1469006 //when he corrupts Vaelastrasz + SAY_GAMESBEGIN_1 = 0, + SAY_GAMESBEGIN_2 = 1, + //SAY_VAEL_INTRO = 2, Not used - when he corrupts Vaelastrasz }; #define GOSSIP_ITEM_1 "I've made no mistakes." @@ -100,7 +101,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF+3: player->CLOSE_GOSSIP_MENU(); - DoScriptText(SAY_GAMESBEGIN_1, creature); + creature->AI()->Talk(SAY_GAMESBEGIN_1); CAST_AI(boss_victor_nefarius::boss_victor_nefariusAI, creature->AI())->BeginEvent(player); break; } @@ -237,7 +238,7 @@ public: void BeginEvent(Player* target) { - DoScriptText(SAY_GAMESBEGIN_2, me); + Talk(SAY_GAMESBEGIN_2); //Trinity::Singleton<MapManager>::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin(); /* diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp index 888171c5415..5ce55307675 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp @@ -27,6 +27,8 @@ EndScriptData */ #include "ScriptedCreature.h" #include "deadmines.h" #include "Spell.h" +#include "Player.h" +#include "WorldSession.h" /*##### # item_Defias_Gunpowder diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index 8e0fb9ff411..1b2beb11351 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -26,6 +26,9 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "deadmines.h" +#include "TemporarySummon.h" +#include "WorldPacket.h" +#include "Opcodes.h" enum Sounds { @@ -213,7 +216,7 @@ class instance_deadmines : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -224,7 +227,7 @@ class instance_deadmines : public InstanceMapScript return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { @@ -237,16 +240,7 @@ class instance_deadmines : public InstanceMapScript void DoPlaySound(GameObject* unit, uint32 sound) { - WorldPacket data(4); - data.SetOpcode(SMSG_PLAY_SOUND); - data << uint32(sound); - unit->SendMessageToSet(&data, false); - } - - void DoPlaySoundCreature(Unit* unit, uint32 sound) - { - WorldPacket data(4); - data.SetOpcode(SMSG_PLAY_SOUND); + WorldPacket data(SMSG_PLAY_SOUND, 4); data << uint32(sound); unit->SendMessageToSet(&data, false); } diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index 8f79c4973f7..71cd69caeb5 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -27,6 +27,7 @@ Script Data End */ #include "ScriptedGossip.h" #include "gnomeregan.h" #include "ScriptedEscortAI.h" +#include "Player.h" #define GOSSIP_START_EVENT "I am ready to being" diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp index 931c0bb90fc..8e126fae588 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "gnomeregan.h" +#include "Player.h" #define MAX_ENCOUNTER 1 @@ -113,7 +114,7 @@ public: } } - uint32 GetData(uint32 uiType) + uint32 GetData(uint32 uiType) const { switch (uiType) { @@ -122,7 +123,7 @@ public: return 0; } - uint64 GetData64(uint32 uiType) + uint64 GetData64(uint32 uiType) const { switch (uiType) { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 2c7e1b9c48a..13c70630c7a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -26,23 +26,27 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#define SAY_AGGRO -1532057 -#define SAY_SUMMON1 -1532058 -#define SAY_SUMMON2 -1532059 -#define SAY_EVOCATE -1532060 -#define SAY_ENRAGE -1532061 -#define SAY_KILL1 -1532062 -#define SAY_KILL2 -1532063 -#define SAY_DEATH -1532064 - -//Flare spell info -#define SPELL_ASTRAL_FLARE_PASSIVE 30234 //Visual effect + Flare damage - -//Curator spell info -#define SPELL_HATEFUL_BOLT 30383 -#define SPELL_EVOCATION 30254 -#define SPELL_ENRAGE 30403 //Arcane Infusion: Transforms Curator and adds damage. -#define SPELL_BERSERK 26662 +enum Curator +{ + SAY_AGGRO = 0, + SAY_SUMMON = 1, + SAY_EVOCATE = 2, + SAY_ENRAGE = 3, + SAY_KILL = 4, + SAY_DEATH = 5, + + //Flare spell info + SPELL_ASTRAL_FLARE_PASSIVE = 30234, //Visual effect + Flare damage + + //Curator spell info + SPELL_HATEFUL_BOLT = 30383, + SPELL_EVOCATION = 30254, + SPELL_ENRAGE = 30403, //Arcane Infusion: Transforms Curator and adds damage. + SPELL_BERSERK = 26662, +}; + + + class boss_curator : public CreatureScript { @@ -78,17 +82,17 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); } void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) @@ -109,7 +113,7 @@ public: } //may not be correct SAY (generic hard enrage) - DoScriptText(SAY_ENRAGE, me); + Talk(SAY_ENRAGE); me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_BERSERK); @@ -151,7 +155,7 @@ public: //if this get's us below 10%, then we evocate (the 10th should be summoned now) if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10) { - DoScriptText(SAY_EVOCATE, me); + Talk(SAY_EVOCATE); me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_EVOCATION); Evocating = true; @@ -162,7 +166,7 @@ public: { if (urand(0, 1) == 0) { - DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me); + Talk(SAY_SUMMON); } } } @@ -174,7 +178,7 @@ public: { Enraged = true; DoCast(me, SPELL_ENRAGE); - DoScriptText(SAY_ENRAGE, me); + Talk(SAY_ENRAGE); } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index 5f974a890bf..026524108b3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -26,19 +26,19 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#define SAY_AGGRO -1532018 -#define SAY_SLAY1 -1532019 -#define SAY_SLAY2 -1532020 -#define SAY_SLAY3 -1532021 -#define SAY_REPENTANCE1 -1532022 -#define SAY_REPENTANCE2 -1532023 -#define SAY_DEATH -1532024 - -#define SPELL_REPENTANCE 29511 -#define SPELL_HOLYFIRE 29522 -#define SPELL_HOLYWRATH 32445 -#define SPELL_HOLYGROUND 29512 -#define SPELL_BERSERK 26662 +enum MaidenOfVirtue +{ + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_REPENTANCE = 2, + SAY_DEATH = 3, + + SPELL_REPENTANCE = 29511, + SPELL_HOLYFIRE = 29522, + SPELL_HOLYWRATH = 32445, + SPELL_HOLYGROUND = 29512, + SPELL_BERSERK = 26662, +}; class boss_maiden_of_virtue : public CreatureScript { @@ -76,17 +76,17 @@ public: void KilledUnit(Unit* /*Victim*/) { if (urand(0, 1) == 0) - DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); } void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) @@ -109,7 +109,7 @@ public: if (Repentance_Timer <= diff) { DoCast(me->getVictim(), SPELL_REPENTANCE); - DoScriptText(RAND(SAY_REPENTANCE1, SAY_REPENTANCE2), me); + Talk(SAY_REPENTANCE); Repentance_Timer = urand(25000, 35000); //A little randomness on that spell } else Repentance_Timer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 7eeced1d970..73fefe210df 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -25,27 +25,27 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellInfo.h" -#define SAY_MIDNIGHT_KILL -1532000 -#define SAY_APPEAR1 -1532001 -#define SAY_APPEAR2 -1532002 -#define SAY_APPEAR3 -1532003 -#define SAY_MOUNT -1532004 -#define SAY_KILL1 -1532005 -#define SAY_KILL2 -1532006 -#define SAY_DISARMED -1532007 -#define SAY_DEATH -1532008 -#define SAY_RANDOM1 -1532009 -#define SAY_RANDOM2 -1532010 - -#define SPELL_SHADOWCLEAVE 29832 -#define SPELL_INTANGIBLE_PRESENCE 29833 -#define SPELL_BERSERKER_CHARGE 26561 //Only when mounted - -#define MOUNTED_DISPLAYID 16040 - -//Attumen (TODO: Use the summoning spell instead of Creature id. It works, but is not convenient for us) -#define SUMMON_ATTUMEN 15550 +enum Midnight +{ + SAY_MIDNIGHT_KILL = 0, + SAY_APPEAR = 1, + SAY_MOUNT = 2, + SAY_KILL = 3, + SAY_DISARMED = 4, + SAY_DEATH = 5, + SAY_RANDOM = 6, + + SPELL_SHADOWCLEAVE = 29832, + SPELL_INTANGIBLE_PRESENCE = 29833, + SPELL_BERSERKER_CHARGE = 26561, //Only when mounted + + MOUNTED_DISPLAYID = 16040, + + //Attumen (TODO: Use the summoning spell instead of Creature id. It works, but is not convenient for us) + SUMMON_ATTUMEN = 15550, +}; class boss_attumen : public CreatureScript { @@ -93,14 +93,14 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); - if (Unit* pMidnight = Unit::GetUnit(*me, Midnight)) - pMidnight->Kill(pMidnight); + Talk(SAY_DEATH); + if (Unit* midnight = Unit::GetUnit(*me, Midnight)) + midnight->Kill(midnight); } void UpdateAI(const uint32 diff); @@ -108,7 +108,7 @@ public: void SpellHit(Unit* /*source*/, const SpellInfo* spell) { if (spell->Mechanic == MECHANIC_DISARM) - DoScriptText(SAY_DISARMED, me); + Talk(SAY_DISARMED); } }; }; @@ -148,7 +148,7 @@ public: if (Phase == 2) { if (Unit* unit = Unit::GetUnit(*me, Attumen)) - DoScriptText(SAY_MIDNIGHT_KILL, unit); + Talk(SAY_MIDNIGHT_KILL, unit->GetGUID()); } } @@ -160,12 +160,12 @@ public: if (Phase == 1 && HealthBelowPct(95)) { Phase = 2; - if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) + if (Creature* attumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) { - Attumen = pAttumen->GetGUID(); - pAttumen->AI()->AttackStart(me->getVictim()); - SetMidnight(pAttumen, me->GetGUID()); - DoScriptText(RAND(SAY_APPEAR1, SAY_APPEAR2, SAY_APPEAR3), pAttumen); + Attumen = attumen->GetGUID(); + attumen->AI()->AttackStart(me->getVictim()); + SetMidnight(attumen, me->GetGUID()); + Talk(SAY_APPEAR, Attumen); } } else if (Phase == 2 && HealthBelowPct(25)) @@ -203,7 +203,7 @@ public: void Mount(Unit* pAttumen) { - DoScriptText(SAY_MOUNT, pAttumen); + Talk(SAY_MOUNT, pAttumen->GetGUID()); Phase = 3; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -273,7 +273,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) if (RandomYellTimer <= diff) { - DoScriptText(RAND(SAY_RANDOM1, SAY_RANDOM2), me); + Talk(SAY_RANDOM); RandomYellTimer = urand(30000, 60000); } else RandomYellTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 99f2cb51c85..38eb3289ec4 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -27,19 +27,20 @@ EndScriptData */ #include "ScriptedCreature.h" #include "karazhan.h" -#define SAY_AGGRO -1532011 -#define SAY_SPECIAL_1 -1532012 -#define SAY_SPECIAL_2 -1532013 -#define SAY_KILL_1 -1532014 -#define SAY_KILL_2 -1532015 -#define SAY_KILL_3 -1532016 -#define SAY_DEATH -1532017 - -#define SPELL_VANISH 29448 -#define SPELL_GARROTE 37066 -#define SPELL_BLIND 34694 -#define SPELL_GOUGE 29425 -#define SPELL_FRENZY 37023 +enum Moroes +{ + SAY_AGGRO = 0, + SAY_SPECIAL = 1, + SAY_KILL = 2, + SAY_DEATH = 3, + + SPELL_VANISH = 29448, + SPELL_GARROTE = 37066, + SPELL_BLIND = 34694, + SPELL_GOUGE = 29425, + SPELL_FRENZY = 37023, +}; + #define POS_Z 81.73f @@ -124,19 +125,19 @@ public: { StartEvent(); - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); AddsAttack(); DoZoneInCombat(); } void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2, SAY_KILL_3), me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(TYPE_MOROES, DONE); @@ -294,7 +295,7 @@ public: { if (Wait_Timer <= diff) { - DoScriptText(RAND(SAY_SPECIAL_1, SAY_SPECIAL_2), me); + Talk(SAY_SPECIAL); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) target->CastSpell(target, SPELL_GARROTE, true); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index c6587c3cd8a..37506d9fd0e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -26,18 +26,23 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "karazhan.h" +#include "Player.h" -#define EMOTE_PHASE_PORTAL -1532089 -#define EMOTE_PHASE_BANISH -1532090 +enum Netherspite +{ + EMOTE_PHASE_PORTAL = 0, + EMOTE_PHASE_BANISH = 1, + + SPELL_NETHERBURN_AURA = 30522, + SPELL_VOIDZONE = 37063, + SPELL_NETHER_INFUSION = 38688, + SPELL_NETHERBREATH = 38523, + SPELL_BANISH_VISUAL = 39833, + SPELL_BANISH_ROOT = 42716, + SPELL_EMPOWERMENT = 38549, + SPELL_NETHERSPITE_ROAR = 38684, +}; -#define SPELL_NETHERBURN_AURA 30522 -#define SPELL_VOIDZONE 37063 -#define SPELL_NETHER_INFUSION 38688 -#define SPELL_NETHERBREATH 38523 -#define SPELL_BANISH_VISUAL 39833 -#define SPELL_BANISH_ROOT 42716 -#define SPELL_EMPOWERMENT 38549 -#define SPELL_NETHERSPITE_ROAR 38684 const float PortalCoord[3][3] = { @@ -228,7 +233,7 @@ public: PortalPhase = true; PortalTimer = 10000; EmpowermentTimer = 10000; - DoScriptText(EMOTE_PHASE_PORTAL, me); + Talk(EMOTE_PHASE_PORTAL); } void SwitchToBanishPhase() @@ -240,7 +245,7 @@ public: DestroyPortals(); PhaseTimer = 30000; PortalPhase = false; - DoScriptText(EMOTE_PHASE_BANISH, me); + Talk(EMOTE_PHASE_BANISH); for (int i=0; i<3; ++i) me->RemoveAurasDueToSpell(NetherBuff[i]); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index d1c4790d705..845a773c108 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -26,19 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "karazhan.h" - -#define SAY_AGGRO -1532091 -#define SAY_AXE_TOSS1 -1532092 -#define SAY_AXE_TOSS2 -1532093 -#define SAY_SPECIAL1 -1532094 -#define SAY_SPECIAL2 -1532095 -#define SAY_SPECIAL3 -1532096 -#define SAY_SLAY1 -1532097 -#define SAY_SLAY2 -1532098 -#define SAY_SLAY3 -1532099 -#define SAY_SUMMON1 -1532100 -#define SAY_SUMMON2 -1532101 -#define SAY_DEATH -1532102 +#include "SpellInfo.h" // 18 Coordinates for Infernal spawns struct InfernalPoint @@ -70,31 +58,43 @@ static InfernalPoint InfernalPoints[] = {-10935.7f, -1996.0f} }; -#define TOTAL_INFERNAL_POINTS 18 - //Enfeeble is supposed to reduce hp to 1 and then heal player back to full when it ends //Along with reducing healing and regen while enfeebled to 0% //This spell effect will only reduce healing - -#define SPELL_ENFEEBLE 30843 //Enfeeble during phase 1 and 2 -#define SPELL_ENFEEBLE_EFFECT 41624 - -#define SPELL_SHADOWNOVA 30852 //Shadownova used during all phases -#define SPELL_SW_PAIN 30854 //Shadow word pain during phase 1 and 3 (different targeting rules though) -#define SPELL_THRASH_PASSIVE 12787 //Extra attack chance during phase 2 -#define SPELL_SUNDER_ARMOR 30901 //Sunder armor during phase 2 -#define SPELL_THRASH_AURA 12787 //Passive proc chance for thrash -#define SPELL_EQUIP_AXES 30857 //Visual for axe equiping -#define SPELL_AMPLIFY_DAMAGE 39095 //Amplifiy during phase 3 -#define SPELL_CLEAVE 30131 //Same as Nightbane. -#define SPELL_HELLFIRE 30859 //Infenals' hellfire aura -#define NETHERSPITE_INFERNAL 17646 //The netherspite infernal creature -#define MALCHEZARS_AXE 17650 //Malchezar's axes (creatures), summoned during phase 3 - -#define INFERNAL_MODEL_INVISIBLE 11686 //Infernal Effects -#define SPELL_INFERNAL_RELAY 30834 - -#define EQUIP_ID_AXE 33542 //Axes info +enum PrinceMalchezaar +{ + SAY_AGGRO = 0, + SAY_AXE_TOSS1 = 1, + SAY_AXE_TOSS2 = 2, +// SAY_SPECIAL1 = 3, Not used, needs to be implemented, but I don't know where it should be used. +// SAY_SPECIAL2 = 4, Not used, needs to be implemented, but I don't know where it should be used. +// SAY_SPECIAL3 = 5, Not used, needs to be implemented, but I don't know where it should be used. + SAY_SLAY = 6, + SAY_SUMMON = 7, + SAY_DEATH = 8, + + TOTAL_INFERNAL_POINTS = 18, + + SPELL_ENFEEBLE = 30843, //Enfeeble during phase 1 and 2 + SPELL_ENFEEBLE_EFFECT = 41624, + + SPELL_SHADOWNOVA = 30852, //Shadownova used during all phases + SPELL_SW_PAIN = 30854, //Shadow word pain during phase 1 and 3 (different targeting rules though) + SPELL_THRASH_PASSIVE = 12787, //Extra attack chance during phase 2 + SPELL_SUNDER_ARMOR = 30901, //Sunder armor during phase 2 + SPELL_THRASH_AURA = 12787, //Passive proc chance for thrash + SPELL_EQUIP_AXES = 30857, //Visual for axe equiping + SPELL_AMPLIFY_DAMAGE = 39095, //Amplifiy during phase 3 + SPELL_CLEAVE = 30131, //Same as Nightbane. + SPELL_HELLFIRE = 30859, //Infenals' hellfire aura + NETHERSPITE_INFERNAL = 17646, //The netherspite infernal creature + MALCHEZARS_AXE = 17650, //Malchezar's axes (creatures), summoned during phase 3 + + INFERNAL_MODEL_INVISIBLE = 11686, //Infernal Effects + SPELL_INFERNAL_RELAY = 30834, + + EQUIP_ID_AXE = 33542, //Axes info +}; //---------Infernal code first class netherspite_infernal : public CreatureScript @@ -244,12 +244,12 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); AxesCleanup(); ClearWeapons(); @@ -265,7 +265,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); if (instance) instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in @@ -383,7 +383,7 @@ public: DoCast(Infernal, SPELL_INFERNAL_RELAY); } - DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me); + Talk(SAY_SUMMON); } void UpdateAI(const uint32 diff) @@ -415,7 +415,7 @@ public: DoCast(me, SPELL_EQUIP_AXES); //text - DoScriptText(SAY_AXE_TOSS1, me); + Talk(SAY_AXE_TOSS1); //passive thrash aura DoCast(me, SPELL_THRASH_AURA, true); @@ -451,7 +451,7 @@ public: //remove thrash me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); - DoScriptText(SAY_AXE_TOSS2, me); + Talk(SAY_AXE_TOSS2); Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); for (uint8 i = 0; i < 2; ++i) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 25fafdfcd0d..843220663b7 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -27,52 +27,50 @@ EndScriptData */ #include "ScriptedCreature.h" #include "karazhan.h" #include "GameObject.h" +#include "SpellInfo.h" -#define SAY_AGGRO1 -1532073 -#define SAY_AGGRO2 -1532074 -#define SAY_AGGRO3 -1532075 -#define SAY_FLAMEWREATH1 -1532076 -#define SAY_FLAMEWREATH2 -1532077 -#define SAY_BLIZZARD1 -1532078 -#define SAY_BLIZZARD2 -1532079 -#define SAY_EXPLOSION1 -1532080 -#define SAY_EXPLOSION2 -1532081 -#define SAY_DRINK -1532082 //Low Mana / AoE Pyroblast -#define SAY_ELEMENTALS -1532083 -#define SAY_KILL1 -1532084 -#define SAY_KILL2 -1532085 -#define SAY_TIMEOVER -1532086 -#define SAY_DEATH -1532087 -#define SAY_ATIESH -1532088 //Atiesh is equipped by a raid member - -//Spells -#define SPELL_FROSTBOLT 29954 -#define SPELL_FIREBALL 29953 -#define SPELL_ARCMISSLE 29955 -#define SPELL_CHAINSOFICE 29991 -#define SPELL_DRAGONSBREATH 29964 -#define SPELL_MASSSLOW 30035 -#define SPELL_FLAME_WREATH 29946 -#define SPELL_AOE_CS 29961 -#define SPELL_PLAYERPULL 32265 -#define SPELL_AEXPLOSION 29973 -#define SPELL_MASS_POLY 29963 -#define SPELL_BLINK_CENTER 29967 -#define SPELL_ELEMENTALS 29962 -#define SPELL_CONJURE 29975 -#define SPELL_DRINK 30024 -#define SPELL_POTION 32453 -#define SPELL_AOE_PYROBLAST 29978 - -//Creature Spells -#define SPELL_CIRCULAR_BLIZZARD 29951 //29952 is the REAL circular blizzard that leaves persistant blizzards that last for 10 seconds -#define SPELL_WATERBOLT 31012 -#define SPELL_SHADOW_PYRO 29978 - -//Creatures -#define CREATURE_WATER_ELEMENTAL 17167 -#define CREATURE_SHADOW_OF_ARAN 18254 -#define CREATURE_ARAN_BLIZZARD 17161 +enum ShadeOfAran +{ + SAY_AGGRO = 0, + SAY_FLAMEWREATH = 1, + SAY_BLIZZARD = 2, + SAY_EXPLOSION = 3, + SAY_DRINK = 4, + SAY_ELEMENTALS = 5, + SAY_KILL = 6, + SAY_TIMEOVER = 7, + SAY_DEATH = 8, +// SAY_ATIESH = 9, Unused + + //Spells + SPELL_FROSTBOLT = 29954, + SPELL_FIREBALL = 29953, + SPELL_ARCMISSLE = 29955, + SPELL_CHAINSOFICE = 29991, + SPELL_DRAGONSBREATH = 29964, + SPELL_MASSSLOW = 30035, + SPELL_FLAME_WREATH = 29946, + SPELL_AOE_CS = 29961, + SPELL_PLAYERPULL = 32265, + SPELL_AEXPLOSION = 29973, + SPELL_MASS_POLY = 29963, + SPELL_BLINK_CENTER = 29967, + SPELL_ELEMENTALS = 29962, + SPELL_CONJURE = 29975, + SPELL_DRINK = 30024, + SPELL_POTION = 32453, + SPELL_AOE_PYROBLAST = 29978, + + //Creature Spells + SPELL_CIRCULAR_BLIZZARD = 29951, + SPELL_WATERBOLT = 31012, + SPELL_SHADOW_PYRO = 29978, + + //Creatures + CREATURE_WATER_ELEMENTAL = 17167, + CREATURE_SHADOW_OF_ARAN = 18254, + CREATURE_ARAN_BLIZZARD = 17161, +}; enum SuperSpell { @@ -159,12 +157,12 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) { @@ -175,7 +173,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me); + Talk(SAY_AGGRO); if (instance) { @@ -263,7 +261,7 @@ public: Drinking = true; me->InterruptNonMeleeSpells(false); - DoScriptText(SAY_DRINK, me); + Talk(SAY_DRINK); if (!DrinkInturrupted) { @@ -383,7 +381,7 @@ public: switch (LastSuperSpell) { case SUPER_AE: - DoScriptText(RAND(SAY_EXPLOSION1, SAY_EXPLOSION2), me); + Talk(SAY_EXPLOSION); DoCast(me, SPELL_BLINK_CENTER, true); DoCast(me, SPELL_PLAYERPULL, true); @@ -392,7 +390,7 @@ public: break; case SUPER_FLAME: - DoScriptText(RAND(SAY_FLAMEWREATH1, SAY_FLAMEWREATH2), me); + Talk(SAY_FLAMEWREATH); FlameWreathTimer = 20000; FlameWreathCheckTime = 500; @@ -405,7 +403,7 @@ public: break; case SUPER_BLIZZARD: - DoScriptText(RAND(SAY_BLIZZARD1, SAY_BLIZZARD2), me); + Talk(SAY_BLIZZARD); if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000)) { @@ -431,7 +429,7 @@ public: } } - DoScriptText(SAY_ELEMENTALS, me); + Talk(SAY_ELEMENTALS); } if (BerserkTimer <= diff) @@ -445,7 +443,7 @@ public: } } - DoScriptText(SAY_TIMEOVER, me); + Talk(SAY_TIMEOVER); BerserkTimer = 60000; } else BerserkTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 688a678060f..cb5a1b7b914 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -28,35 +28,36 @@ EndScriptData */ #include "karazhan.h" #include "PassiveAI.h" -#define SAY_SLAY1 -1532065 -#define SAY_SLAY2 -1532066 -#define SAY_DEATH -1532067 -#define SAY_AGGRO -1532068 -#define SAY_SACRIFICE1 -1532069 -#define SAY_SACRIFICE2 -1532070 -#define SAY_SUMMON1 -1532071 -#define SAY_SUMMON2 -1532072 - -#define SPELL_SUMMON_DEMONCHAINS 30120 // Summons demonic chains that maintain the ritual of sacrifice. -#define SPELL_DEMON_CHAINS 30206 // Instant - Visual Effect -#define SPELL_ENRAGE 23537 // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min. -#define SPELL_SHADOW_BOLT 30055 // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage. -#define SPELL_SACRIFICE 30115 // Teleports and adds the debuff -#define SPELL_BERSERK 32965 // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley. -#define SPELL_SUMMON_FIENDISIMP 30184 // Summons a Fiendish Imp. -#define SPELL_SUMMON_IMP 30066 // Summons Kil'rek - -#define SPELL_FIENDISH_PORTAL 30171 // Opens portal and summons Fiendish Portal, 2 sec cast -#define SPELL_FIENDISH_PORTAL_1 30179 // Opens portal and summons Fiendish Portal, instant cast - -#define SPELL_FIREBOLT 30050 // Blasts a target for 150 Fire damage. -#define SPELL_BROKEN_PACT 30065 // All damage taken increased by 25%. -#define SPELL_AMPLIFY_FLAMES 30053 // Increases the Fire damage taken by an enemy by 500 for 25 sec. - -#define CREATURE_DEMONCHAINS 17248 -#define CREATURE_FIENDISHIMP 17267 -#define CREATURE_PORTAL 17265 -#define CREATURE_KILREK 17229 +enum TerestianIllhoof +{ + SAY_SLAY = 1, + SAY_DEATH = 2, + SAY_AGGRO = 3, + SAY_SACRIFICE = 4, + SAY_SUMMON = 5, + + SPELL_SUMMON_DEMONCHAINS = 30120, // Summons demonic chains that maintain the ritual of sacrifice. + SPELL_DEMON_CHAINS = 30206, // Instant - Visual Effect + SPELL_ENRAGE = 23537, // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min. + SPELL_SHADOW_BOLT = 30055, // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage. + SPELL_SACRIFICE = 30115, // Teleports and adds the debuff + SPELL_BERSERK = 32965, // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley. + SPELL_SUMMON_FIENDISIMP = 30184, // Summons a Fiendish Imp. + SPELL_SUMMON_IMP = 30066, // Summons Kil'rek + + SPELL_FIENDISH_PORTAL = 30171, // Opens portal and summons Fiendish Portal, 2 sec cast + SPELL_FIENDISH_PORTAL_1 = 30179, // Opens portal and summons Fiendish Portal, instant cast + + SPELL_FIREBOLT = 30050, // Blasts a target for 150 Fire damage. + SPELL_BROKEN_PACT = 30065, // All damage taken increased by 25%. + SPELL_AMPLIFY_FLAMES = 30053, // Increases the Fire damage taken by an enemy by 500 for 25 sec. + + CREATURE_DEMONCHAINS = 17248, + CREATURE_FIENDISHIMP = 17267, + CREATURE_PORTAL = 17265, + CREATURE_KILREK = 17229, +}; + class mob_kilrek : public CreatureScript { @@ -319,7 +320,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void JustSummoned(Creature* summoned) @@ -331,7 +332,7 @@ public: if (summoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1) { - DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me); + Talk(SAY_SUMMON); SummonedPortals = true; } } @@ -339,7 +340,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) @@ -355,7 +356,7 @@ public: } } - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(TYPE_TERESTIAN, DONE); @@ -378,7 +379,7 @@ public: { CAST_AI(mob_demon_chain::mob_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID(); Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); - DoScriptText(RAND(SAY_SACRIFICE1, SAY_SACRIFICE2), me); + Talk(SAY_SACRIFICE); SacrificeTimer = 30000; } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index a4f4f603206..7053cbb3ed7 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -27,68 +27,75 @@ EndScriptData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "karazhan.h" +#include "Player.h" +#include "SpellInfo.h" /***********************************/ /*** OPERA WIZARD OF OZ EVENT *****/ /*********************************/ +enum Says +{ + SAY_DOROTHEE_DEATH = 0, + SAY_DOROTHEE_SUMMON = 1, + SAY_DOROTHEE_TITO_DEATH = 2, + SAY_DOROTHEE_AGGRO = 3, + + SAY_ROAR_AGGRO = 0, + SAY_ROAR_DEATH = 1, + SAY_ROAR_SLAY = 2, + + SAY_STRAWMAN_AGGRO = 0, + SAY_STRAWMAN_DEATH = 1, + SAY_STRAWMAN_SLAY = 2, + + SAY_TINHEAD_AGGRO = 0, + SAY_TINHEAD_DEATH = 1, + SAY_TINHEAD_SLAY = 2, + EMOTE_RUST = 3, + + SAY_CRONE_AGGRO = 0, + SAY_CRONE_DEATH = 1, + SAY_CRONE_SLAY = 2, +}; -#define SAY_DOROTHEE_DEATH -1532025 -#define SAY_DOROTHEE_SUMMON -1532026 -#define SAY_DOROTHEE_TITO_DEATH -1532027 -#define SAY_DOROTHEE_AGGRO -1532028 - -#define SAY_ROAR_AGGRO -1532029 -#define SAY_ROAR_DEATH -1532030 -#define SAY_ROAR_SLAY -1532031 - -#define SAY_STRAWMAN_AGGRO -1532032 -#define SAY_STRAWMAN_DEATH -1532033 -#define SAY_STRAWMAN_SLAY -1532034 - -#define SAY_TINHEAD_AGGRO -1532035 -#define SAY_TINHEAD_DEATH -1532036 -#define SAY_TINHEAD_SLAY -1532037 -#define EMOTE_RUST -1532038 - -#define SAY_CRONE_AGGRO -1532039 -#define SAY_CRONE_AGGRO2 -1532040 -#define SAY_CRONE_DEATH -1532041 -#define SAY_CRONE_SLAY -1532042 - -/**** Spells ****/ -// Dorothee -#define SPELL_WATERBOLT 31012 -#define SPELL_SCREAM 31013 -#define SPELL_SUMMONTITO 31014 - -// Tito -#define SPELL_YIPPING 31015 - -// Strawman -#define SPELL_BRAIN_BASH 31046 -#define SPELL_BRAIN_WIPE 31069 -#define SPELL_BURNING_STRAW 31075 - -// Tinhead -#define SPELL_CLEAVE 31043 -#define SPELL_RUST 31086 - -// Roar -#define SPELL_MANGLE 31041 -#define SPELL_SHRED 31042 -#define SPELL_FRIGHTENED_SCREAM 31013 - -// Crone -#define SPELL_CHAIN_LIGHTNING 32337 - -// Cyclone -#define SPELL_KNOCKBACK 32334 -#define SPELL_CYCLONE_VISUAL 32332 +enum Spells +{ + // Dorothee + SPELL_WATERBOLT = 31012, + SPELL_SCREAM = 31013, + SPELL_SUMMONTITO = 31014, + + // Tito + SPELL_YIPPING = 31015, + + // Strawman + SPELL_BRAIN_BASH = 31046, + SPELL_BRAIN_WIPE = 31069, + SPELL_BURNING_STRAW = 31075, + + // Tinhead + SPELL_CLEAVE = 31043, + SPELL_RUST = 31086, + + // Roar + SPELL_MANGLE = 31041, + SPELL_SHRED = 31042, + SPELL_FRIGHTENED_SCREAM = 31013, + + // Crone + SPELL_CHAIN_LIGHTNING = 32337, + + // Cyclone + SPELL_KNOCKBACK = 32334, + SPELL_CYCLONE_VISUAL = 32332, +}; -/** Creature Entries **/ -#define CREATURE_TITO 17548 -#define CREATURE_CYCLONE 18412 -#define CREATURE_CRONE 18168 +enum Creatures +{ + CREATURE_TITO = 17548, + CREATURE_CYCLONE = 18412, + CREATURE_CRONE = 18168, +}; void SummonCroneIfReady(InstanceScript* instance, Creature* creature) { @@ -146,7 +153,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_DOROTHEE_AGGRO, me); + Talk(SAY_DOROTHEE_AGGRO); } void JustReachedHome() @@ -158,7 +165,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DOROTHEE_DEATH, me); + Talk(SAY_DOROTHEE_DEATH); if (instance) SummonCroneIfReady(instance, me); @@ -251,7 +258,7 @@ public: if (Dorothee && Dorothee->isAlive()) { CAST_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true; - DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee); + Talk(SAY_DOROTHEE_TITO_DEATH, Dorothee->GetGUID()); } } } @@ -276,7 +283,7 @@ void boss_dorothee::boss_dorotheeAI::SummonTito() { if (Creature* pTito = me->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { - DoScriptText(SAY_DOROTHEE_SUMMON, me); + Talk(SAY_DOROTHEE_SUMMON); CAST_AI(mob_tito::mob_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID(); pTito->AI()->AttackStart(me->getVictim()); SummonedTito = true; @@ -332,7 +339,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_STRAWMAN_AGGRO, me); + Talk(SAY_STRAWMAN_AGGRO); } void JustReachedHome() @@ -355,7 +362,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_STRAWMAN_DEATH, me); + Talk(SAY_STRAWMAN_DEATH); if (instance) SummonCroneIfReady(instance, me); @@ -363,7 +370,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_STRAWMAN_SLAY, me); + Talk(SAY_STRAWMAN_SLAY); } void UpdateAI(const uint32 diff) @@ -434,7 +441,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_TINHEAD_AGGRO, me); + Talk(SAY_TINHEAD_AGGRO); } void JustReachedHome() @@ -460,7 +467,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_TINHEAD_DEATH, me); + Talk(SAY_TINHEAD_DEATH); if (instance) SummonCroneIfReady(instance, me); @@ -468,7 +475,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_TINHEAD_SLAY, me); + Talk(SAY_TINHEAD_SLAY); } void UpdateAI(const uint32 diff) @@ -496,7 +503,7 @@ public: if (RustTimer <= diff) { ++RustCount; - DoScriptText(EMOTE_RUST, me); + Talk(EMOTE_RUST); DoCast(me, SPELL_RUST); RustTimer = 6000; } else RustTimer -= diff; @@ -557,7 +564,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_ROAR_AGGRO, me); + Talk(SAY_ROAR_AGGRO); } void JustReachedHome() @@ -567,7 +574,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_ROAR_DEATH, me); + Talk(SAY_ROAR_DEATH); if (instance) SummonCroneIfReady(instance, me); @@ -575,7 +582,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_ROAR_SLAY, me); + Talk(SAY_ROAR_SLAY); } void UpdateAI(const uint32 diff) @@ -648,16 +655,21 @@ public: me->DespawnOrUnsummon(); } + void KilledUnit(Unit* /*victim*/) + { + Talk(SAY_CRONE_SLAY); + } + void EnterCombat(Unit* /*who*/) { - DoScriptText(RAND(SAY_CRONE_AGGRO, SAY_CRONE_AGGRO2), me); + Talk(SAY_CRONE_AGGRO); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_CRONE_DEATH, me); + Talk(SAY_CRONE_DEATH); if (instance) { @@ -742,22 +754,24 @@ public: /**************************************/ /**** Opera Red Riding Hood Event* ***/ /************************************/ +enum RedRidingHood +{ + SAY_WOLF_AGGRO = 0, + SAY_WOLF_SLAY = 1, + SAY_WOLF_HOOD = 2, + SOUND_WOLF_DEATH = 9275, -/**** Yells for the Wolf ****/ -#define SAY_WOLF_AGGRO -1532043 -#define SAY_WOLF_SLAY -1532044 -#define SAY_WOLF_HOOD -1532045 -#define SOUND_WOLF_DEATH 9275 //Only sound on death, no text. + SPELL_LITTLE_RED_RIDING_HOOD = 30768, + SPELL_TERRIFYING_HOWL = 30752, + SPELL_WIDE_SWIPE = 30761, + + CREATURE_BIG_BAD_WOLF = 17521, +}; -/**** Spells For The Wolf ****/ -#define SPELL_LITTLE_RED_RIDING_HOOD 30768 -#define SPELL_TERRIFYING_HOWL 30752 -#define SPELL_WIDE_SWIPE 30761 #define GOSSIP_GRANDMA "What phat lewtz you have grandmother?" -/**** The Wolf's Entry* ***/ -#define CREATURE_BIG_BAD_WOLF 17521 + class npc_grandmother : public CreatureScript { @@ -829,7 +843,12 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_WOLF_AGGRO, me); + Talk(SAY_WOLF_AGGRO); + } + + void KilledUnit(Unit* /*victim*/) + { + Talk(SAY_WOLF_SLAY); } void JustReachedHome() @@ -865,7 +884,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - DoScriptText(SAY_WOLF_HOOD, me); + Talk(SAY_WOLF_HOOD); DoCast(target, SPELL_LITTLE_RED_RIDING_HOOD, true); TempThreat = DoGetThreat(target); if (TempThreat) @@ -915,41 +934,41 @@ public: /******** Opera Romeo and Juliet Event* ******/ /********************************************/ -/**** Speech *****/ -#define SAY_JULIANNE_AGGRO -1532046 -#define SAY_JULIANNE_ENTER -1532047 -#define SAY_JULIANNE_DEATH01 -1532048 -#define SAY_JULIANNE_DEATH02 -1532049 -#define SAY_JULIANNE_RESURRECT -1532050 -#define SAY_JULIANNE_SLAY -1532051 - -#define SAY_ROMULO_AGGRO -1532052 -#define SAY_ROMULO_DEATH -1532053 -#define SAY_ROMULO_ENTER -1532054 -#define SAY_ROMULO_RESURRECT -1532055 -#define SAY_ROMULO_SLAY -1532056 - -/***** Spells For Julianne *****/ -#define SPELL_BLINDING_PASSION 30890 -#define SPELL_DEVOTION 30887 -#define SPELL_ETERNAL_AFFECTION 30878 -#define SPELL_POWERFUL_ATTRACTION 30889 -#define SPELL_DRINK_POISON 30907 - -/***** Spells For Romulo ****/ -#define SPELL_BACKWARD_LUNGE 30815 -#define SPELL_DARING 30841 -#define SPELL_DEADLY_SWATHE 30817 -#define SPELL_POISON_THRUST 30822 - -/**** Other Misc. Spells ****/ -#define SPELL_UNDYING_LOVE 30951 -#define SPELL_RES_VISUAL 24171 - -/*** Misc. Information ****/ -#define CREATURE_ROMULO 17533 -#define ROMULO_X -10900 -#define ROMULO_Y -1758 +enum JulianneRomulo +{ + /**** Speech *****/ + SAY_JULIANNE_AGGRO = 0, + SAY_JULIANNE_ENTER = 1, + SAY_JULIANNE_DEATH01 = 2, + SAY_JULIANNE_DEATH02 = 3, + SAY_JULIANNE_RESURRECT = 4, + SAY_JULIANNE_SLAY = 5, + + SAY_ROMULO_AGGRO = 0, + SAY_ROMULO_DEATH = 1, + SAY_ROMULO_ENTER = 2, + SAY_ROMULO_RESURRECT = 3, + SAY_ROMULO_SLAY = 4, + + SPELL_BLINDING_PASSION = 30890, + SPELL_DEVOTION = 30887, + SPELL_ETERNAL_AFFECTION = 30878, + SPELL_POWERFUL_ATTRACTION = 30889, + SPELL_DRINK_POISON = 30907, + + SPELL_BACKWARD_LUNGE = 30815, + SPELL_DARING = 30841, + SPELL_DEADLY_SWATHE = 30817, + SPELL_POISON_THRUST = 30822, + + SPELL_UNDYING_LOVE = 30951, + SPELL_RES_VISUAL = 24171, + + CREATURE_ROMULO = 17533, + ROMULO_X = -10900, + ROMULO_Y = -1758, +}; + enum RAJPhase { @@ -1076,7 +1095,7 @@ public: { if (Spell->Id == SPELL_DRINK_POISON) { - DoScriptText(SAY_JULIANNE_DEATH01, me); + Talk(SAY_JULIANNE_DEATH01); DrinkPoisonTimer = 2500; } } @@ -1085,7 +1104,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_JULIANNE_DEATH02, me); + Talk(SAY_JULIANNE_DEATH02); if (instance) { @@ -1099,7 +1118,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_JULIANNE_SLAY, me); + Talk(SAY_JULIANNE_SLAY); } void UpdateAI(const uint32 diff); @@ -1170,7 +1189,7 @@ public: if (Phase == PHASE_ROMULO) { - DoScriptText(SAY_ROMULO_DEATH, me); + Talk(SAY_ROMULO_DEATH); PretendToDie(me); IsFakingDeath = true; Phase = PHASE_BOTH; @@ -1217,7 +1236,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_ROMULO_AGGRO, me); + Talk(SAY_ROMULO_AGGRO); if (JulianneGUID) { Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); @@ -1239,7 +1258,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_ROMULO_DEATH, me); + Talk(SAY_ROMULO_DEATH); if (instance) { @@ -1254,7 +1273,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_ROMULO_SLAY, me); + Talk(SAY_ROMULO_SLAY); } void UpdateAI(const uint32 diff) @@ -1269,7 +1288,7 @@ public: Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); if (Julianne && CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath) { - DoScriptText(SAY_ROMULO_RESURRECT, me); + Talk(SAY_ROMULO_RESURRECT); Resurrect(Julianne); CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath = false; JulianneDead = false; @@ -1318,7 +1337,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff) { if (EntryYellTimer <= diff) { - DoScriptText(SAY_JULIANNE_ENTER, me); + Talk(SAY_JULIANNE_ENTER); EntryYellTimer = 0; } else EntryYellTimer -= diff; } @@ -1327,7 +1346,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff) { if (AggroYellTimer <= diff) { - DoScriptText(SAY_JULIANNE_AGGRO, me); + Talk(SAY_JULIANNE_AGGRO); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->setFaction(16); AggroYellTimer = 0; @@ -1389,7 +1408,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff) Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); if (Romulo && CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath) { - DoScriptText(SAY_JULIANNE_RESURRECT, me); + Talk(SAY_JULIANNE_RESURRECT); Resurrect(Romulo); CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath = false; RomuloDead = false; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 2ecd98cbc4c..2937d0ab700 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -241,7 +241,7 @@ public: return strSaveData; } - uint32 GetData(uint32 uiData) + uint32 GetData(uint32 uiData) const { switch (uiData) { @@ -264,7 +264,7 @@ public: return 0; } - uint64 GetData64(uint32 uiData) + uint64 GetData64(uint32 uiData) const { switch (uiData) { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 3bdfeab30da..660b8f6c460 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -34,6 +34,7 @@ EndContentData */ #include "ScriptedGossip.h" #include "karazhan.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### # npc_barnesAI @@ -62,26 +63,26 @@ struct Dialogue static Dialogue OzDialogue[]= { - {-1532103, 6000}, - {-1532104, 18000}, - {-1532105, 9000}, - {-1532106, 15000} + {0, 6000}, + {1, 18000}, + {2, 9000}, + {3, 15000} }; static Dialogue HoodDialogue[]= { - {-1532107, 6000}, - {-1532108, 10000}, - {-1532109, 14000}, - {-1532110, 15000} + {4, 6000}, + {5, 10000}, + {6, 14000}, + {7, 15000} }; static Dialogue RAJDialogue[]= { - {-1532111, 5000}, - {-1532112, 7000}, - {-1532113, 14000}, - {-1532114, 14000} + {8, 5000}, + {9, 7000}, + {10, 14000}, + {11, 14000} }; // Entries and spawn locations for creatures in Oz event @@ -224,7 +225,8 @@ public: } if (text) - DoScriptText(text, me); + CreatureAI::Talk(text); + } void PrepareEncounter() diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index e21a84d9499..eec520f04e2 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "magisters_terrace.h" #include "WorldPacket.h" +#include "Opcodes.h" #define SAY_AGGRO -1585023 //This yell should be done when the room is cleared. For now, set it as a movelineofsight yell. #define SAY_PHOENIX -1585024 @@ -140,12 +141,7 @@ public: Phase = 0; if (instance) - { instance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); - instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), true); - // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) - // Small door opened after event are expected to be closed by default - } } void JustDied(Unit* /*killer*/) @@ -155,12 +151,11 @@ public: if (!instance) return; - // Open the encounter door - instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), true); + instance->SetData(DATA_KAELTHAS_EVENT, DONE); // Enable the Translocation Orb Exit if (GameObject* escapeOrb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ESCAPE_ORB))) - escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) @@ -173,9 +168,8 @@ public: { if (!instance) return; - - //Close the encounter door, open it in JustDied/Reset - instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), false); + + instance->SetData(DATA_KAELTHAS_EVENT, IN_PROGRESS); } void MoveInLineOfSight(Unit* who) @@ -248,8 +242,7 @@ public: // Also needs an exception in spell system. unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); // Use packet hack - WorldPacket data(12); - data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); + WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12); data.append(unit->GetPackGUID()); data << uint32(0); unit->SendMessageToSet(&data, true); @@ -269,8 +262,7 @@ public: unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); - WorldPacket data(12); - data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); + WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12); data.append(unit->GetPackGUID()); data << uint32(0); unit->SendMessageToSet(&data, true); @@ -369,14 +361,10 @@ public: FirstGravityLapse = false; if (instance) - { - instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_LEFT), true); - instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_RIGHT), true); - } - }else - { - DoScriptText(SAY_RECAST_GRAVITY, me); + instance->SetData(DATA_KAELTHAS_STATUES, 1); } + else + DoScriptText(SAY_RECAST_GRAVITY, me); DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL); GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 430bbb79bde..7b79c18239e 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -75,6 +75,7 @@ public: uint32 size = instance->GetData(DATA_FEL_CRYSTAL_SIZE); for (uint8 i = 0; i < size; ++i) { + instance->SetData64(DATA_FEL_CRYSTAL, i); uint64 guid = instance->GetData64(DATA_FEL_CRYSTAL); sLog->outDebug(LOG_FILTER_TSCR, "Selin: Adding Fel Crystal " UI64FMTD " to list", guid); Crystals.push_back(guid); @@ -115,10 +116,6 @@ public: } } - instance->HandleGameObject(instance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); - // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) - // Small door opened after event are expected to be closed by default - // Set Inst data for encounter instance->SetData(DATA_SELIN_EVENT, NOT_STARTED); } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA); @@ -196,10 +193,8 @@ public: void EnterCombat(Unit* /*who*/) { DoScriptText(SAY_AGGRO, me); - if (instance) - instance->HandleGameObject(instance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), false); - //Close the encounter door, open it in JustDied/Reset + instance->SetData(DATA_SELIN_EVENT, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) @@ -237,8 +232,6 @@ public: return; instance->SetData(DATA_SELIN_EVENT, DONE); // Encounter complete! - instance->HandleGameObject(instance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the encounter door - instance->HandleGameObject(instance->GetData64(DATA_SELIN_DOOR), true); // Open the door leading further in ShatterRemainingCrystals(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index da8b24c3985..c8bf50c0bcc 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -72,8 +72,7 @@ public: uint32 Encounter[MAX_ENCOUNTER]; uint32 DelrissaDeathCount; - std::list<uint64> FelCrystals; - std::list<uint64>::const_iterator CrystalItr; + std::vector<uint64> FelCrystals; uint64 SelinGUID; uint64 DelrissaGUID; @@ -84,8 +83,8 @@ public: uint64 KaelDoorGUID; uint64 KaelStatue[2]; uint64 EscapeOrbGUID; - - bool InitializedItr; + uint32 StatuesState; + uint8 felCristalIndex; void Initialize() { @@ -105,8 +104,8 @@ public: KaelStatue[0] = 0; KaelStatue[1] = 0; EscapeOrbGUID = 0; - - InitializedItr = false; + StatuesState = 0; + felCristalIndex = 0; } bool IsEncounterInProgress() const @@ -117,7 +116,7 @@ public: return false; } - uint32 GetData(uint32 identifier) + uint32 GetData(uint32 identifier) const { switch (identifier) { @@ -142,21 +141,35 @@ public: switch (identifier) { case DATA_SELIN_EVENT: + if (data == DONE) + { + HandleGameObject(SelinEncounterDoorGUID, true); + HandleGameObject(SelinDoorGUID, true); + } + else if (data == IN_PROGRESS) + HandleGameObject(SelinEncounterDoorGUID, false); + else if (data == NOT_STARTED) + HandleGameObject(SelinEncounterDoorGUID, true); + Encounter[0] = data; break; case DATA_VEXALLUS_EVENT: if (data == DONE) - DoUseDoorOrButton(VexallusDoorGUID); + HandleGameObject(VexallusDoorGUID, true); Encounter[1] = data; break; case DATA_DELRISSA_EVENT: if (data == DONE) - DoUseDoorOrButton(DelrissaDoorGUID); + HandleGameObject(DelrissaDoorGUID, true); if (data == IN_PROGRESS) DelrissaDeathCount = 0; Encounter[2] = data; break; case DATA_KAELTHAS_EVENT: + if (data == NOT_STARTED || data == DONE) + HandleGameObject(KaelDoorGUID, true); + else if (data == IN_PROGRESS) + HandleGameObject(KaelDoorGUID, false); Encounter[3] = data; break; case DATA_DELRISSA_DEATH_COUNT: @@ -165,7 +178,14 @@ public: else DelrissaDeathCount = 0; break; + case DATA_KAELTHAS_STATUES: + HandleGameObject(KaelStatue[0], data); + HandleGameObject(KaelStatue[1], data); + StatuesState = data; + break; } + + SaveToDB(); } void OnCreatureCreate(Creature* creature) @@ -215,7 +235,45 @@ public: } } - uint64 GetData64(uint32 identifier) + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << Encounter[0] << ' ' << Encounter[1] << ' ' << Encounter[2] << ' ' << Encounter[3] << ' ' << StatuesState; + + 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); + + std::istringstream loadStream(str); + + for (uint32 i = 0; i < MAX_ENCOUNTER; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetData(i, tmpState); + } + + loadStream >> StatuesState; + SetData(DATA_KAELTHAS_STATUES, StatuesState); + + OUT_LOAD_INST_DATA_COMPLETE; + } + + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -225,10 +283,6 @@ public: return DelrissaGUID; case DATA_VEXALLUS_DOOR: return VexallusDoorGUID; - case DATA_SELIN_DOOR: - return SelinDoorGUID; - case DATA_SELIN_ENCOUNTER_DOOR: - return SelinEncounterDoorGUID; case DATA_DELRISSA_DOOR: return DelrissaDoorGUID; case DATA_KAEL_DOOR: @@ -239,28 +293,23 @@ public: return KaelStatue[1]; case DATA_ESCAPE_ORB: return EscapeOrbGUID; - case DATA_FEL_CRYSTAL: - { - if (FelCrystals.empty()) + if (FelCrystals.size() < felCristalIndex) { sLog->outError(LOG_FILTER_TSCR, "Magisters Terrace: No Fel Crystals loaded in Inst Data"); return 0; } - if (!InitializedItr) - { - CrystalItr = FelCrystals.begin(); - InitializedItr = true; - } - - uint64 guid = *CrystalItr; - ++CrystalItr; - return guid; - } + return FelCrystals.at(felCristalIndex); } return 0; } + + void SetData64(uint32 identifier, uint64 value) + { + if (identifier == DATA_FEL_CRYSTAL) + felCristalIndex = value; + } }; }; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index 64b6c8d75b2..5925be5f415 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -30,6 +30,8 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ## npc_kalecgos diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h index 660e58d325a..41b847635d7 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h @@ -23,28 +23,26 @@ enum Data { - DATA_SELIN_EVENT = 0, - DATA_VEXALLUS_EVENT = 1, - DATA_DELRISSA_EVENT = 2, - DATA_KAELTHAS_EVENT = 3, - - DATA_SELIN = 4, - DATA_FEL_CRYSTAL = 5, - DATA_FEL_CRYSTAL_SIZE = 6, - - DATA_VEXALLUS_DOOR = 7, - DATA_SELIN_DOOR = 8, - DATA_DELRISSA = 9, - DATA_DELRISSA_DOOR = 10, - DATA_SELIN_ENCOUNTER_DOOR = 11, - - DATA_KAEL_DOOR = 12, - DATA_KAEL_STATUE_LEFT = 13, - DATA_KAEL_STATUE_RIGHT = 14, - - DATA_DELRISSA_DEATH_COUNT = 15, - - DATA_ESCAPE_ORB = 16 + DATA_SELIN_EVENT, + DATA_VEXALLUS_EVENT, + DATA_DELRISSA_EVENT, + DATA_KAELTHAS_EVENT, + + DATA_SELIN, + DATA_FEL_CRYSTAL, + DATA_FEL_CRYSTAL_SIZE, + + DATA_VEXALLUS_DOOR, + DATA_DELRISSA, + DATA_DELRISSA_DOOR, + + DATA_KAEL_DOOR, + DATA_KAEL_STATUE_LEFT, + DATA_KAEL_STATUE_RIGHT, + + DATA_DELRISSA_DEATH_COUNT, + DATA_KAELTHAS_STATUES, + DATA_ESCAPE_ORB }; #endif diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp index f085e15fcb7..c7d6b31d2ea 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "molten_core.h" +#include "Player.h" enum Texts { diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp index f6a6e647a1d..1a055b9bce0 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "InstanceScript.h" #include "CreatureAI.h" #include "molten_core.h" +#include "TemporarySummon.h" Position const SummonPositions[10] = { @@ -116,7 +117,7 @@ class instance_molten_core : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -127,7 +128,7 @@ class instance_molten_core : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index c17a059d007..0cb2bd7f7bc 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -23,6 +23,8 @@ #include "ScriptedEscortAI.h" #include "CombatAI.h" #include "PassiveAI.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ##Quest 12848 @@ -307,7 +309,7 @@ public: prisonerGUID = guid; } - uint64 GetGUID(int32 /*id*/) + uint64 GetGUID(int32 /*id*/) const { return prisonerGUID; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index b4c6268a43e..7a6e9aab31d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "SpellInfo.h" //How to win friends and influence enemies // texts signed for creature 28939 but used for 28939, 28940, 28610 diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 4d1552b932e..686f5954e77 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" #define LESS_MOB // if you do not have a good server and do not want it to be laggy as hell //Light of Dawn diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp index 81211f36df3..6e7f7e103c5 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "PassiveAI.h" +#include "Player.h" /*#### ## npc_valkyr_battle_maiden diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp index c39a647d5e1..33335c32d05 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp @@ -28,8 +28,8 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1189019, - SAY_SPECIALAE = -1189020, + SAY_AGGRO = 0, + SAY_SPECIALAE = 1, SPELL_POLYMORPH = 13323, SPELL_AOESILENCE = 8988, @@ -69,7 +69,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) @@ -93,7 +93,7 @@ public: if (me->IsNonMeleeSpellCasted(false)) return; - DoScriptText(SAY_SPECIALAE, me); + Talk(SAY_SPECIALAE); DoCast(me, SPELL_ARCANEBUBBLE); bCanDetonate = true; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp index ff1a0867de0..b97e1d15dc0 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp @@ -28,9 +28,9 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1189016, - SAY_HEALTH = -1189017, - SAY_KILL = -1189018, + SAY_AGGRO = 0, + SAY_HEALTH = 1, + SAY_KILL = 2, SPELL_FLAMESHOCK = 8053, SPELL_SHADOWBOLT = 1106, @@ -69,12 +69,12 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void KilledUnit(Unit* /*Victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void UpdateAI(const uint32 diff) @@ -85,7 +85,7 @@ public: //If we are <35% hp if (!HpYell && !HealthAbovePct(35)) { - DoScriptText(SAY_HEALTH, me); + Talk(SAY_HEALTH); HpYell = true; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 5e7fa111a7b..78a5f3797d8 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -28,17 +28,20 @@ EndScriptData */ #include "SpellMgr.h" #include "scarlet_monastery.h" #include "LFGMgr.h" +#include "Player.h" +#include "SpellInfo.h" //this texts are already used by 3975 and 3976 enum Says { - SAY_ENTRANCE = -1189001, - SAY_REJOINED = -1189002, - SAY_LOST_HEAD = -1189003, - SAY_CONFLAGRATION = -1189004, - SAY_SPROUTING_PUMPKINS = -1189005, - SAY_PLAYER_DEATH = -1189006, - SAY_DEATH = -1189007 + SAY_LOST_HEAD = 0, + SAY_PLAYER_DEATH = 1, + + SAY_ENTRANCE = 0, + SAY_REJOINED = 1, + SAY_CONFLAGRATION = 2, + SAY_SPROUTING_PUMPKINS = 3, + SAY_DEATH = 4, }; uint32 RandomLaugh[] = {11965, 11975, 11976}; @@ -249,13 +252,17 @@ public: laugh = urand(15000, 30000); } - void EnterCombat(Unit* /*who*/) {} - void SaySound(int32 textEntry, Unit* target = 0) + void EnterCombat(Unit* /*who*/) { } + + void SaySound(uint8 textEntry, Unit* target = 0) { - DoScriptText(textEntry, me, target); + if (target) + Talk(textEntry, target->GetGUID()); + else + Talk(textEntry); + //DoCast(me, SPELL_HEAD_SPEAKS, true); - Creature* speaker = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 1000); - if (speaker) + if (Creature* speaker = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 1000)) speaker->CastSpell(speaker, SPELL_HEAD_SPEAKS, false); laugh += 3000; } @@ -515,9 +522,12 @@ public: } } - void SaySound(int32 textEntry, Unit* target = 0) + void SaySound(uint8 textEntry, Unit* target = 0) { - DoScriptText(textEntry, me, target); + if (target) + Talk(textEntry, target->GetGUID()); + else + Talk(textEntry); laugh += 4000; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp index dbbbb7fb0dd..8c1b22e9871 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp @@ -29,15 +29,11 @@ EndScriptData */ enum Says { - SAY_AGGRO = -1189000, - SAY_WHIRLWIND = -1189001, - SAY_ENRAGE = -1189002, - SAY_KILL = -1189003 -}; - -enum Emotes -{ - EMOTE_ENRAGE = -1189004 + SAY_AGGRO = 0, + SAY_WHIRLWIND = 1, + SAY_ENRAGE = 2, + SAY_KILL = 3, + EMOTE_ENRAGE = 4 }; enum Spells @@ -82,13 +78,13 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); DoCast(me, SPELL_RUSHINGCHARGE); } void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) @@ -105,8 +101,8 @@ public: //If we are <30% hp goes Enraged if (!Enrage && !HealthAbovePct(30) && !me->IsNonMeleeSpellCasted(false)) { - DoScriptText(EMOTE_ENRAGE, me); - DoScriptText(SAY_ENRAGE, me); + Talk(EMOTE_ENRAGE); + Talk(SAY_ENRAGE); DoCast(me, SPELL_FRENZY); Enrage = true; } @@ -122,7 +118,7 @@ public: // Whirlwind_Timer if (Whirlwind_Timer <= diff) { - DoScriptText(SAY_WHIRLWIND, me); + Talk(SAY_WHIRLWIND); DoCast(me->getVictim(), SPELL_WHIRLWIND); Whirlwind_Timer = 30000; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp index 9a66c9ba728..0d08431d39c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp @@ -28,7 +28,7 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1189021, + SAY_AGGRO = 0, SPELL_SUMMONSCARLETHOUND = 17164, SPELL_BLOODLUST = 6742 }; @@ -56,7 +56,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index 07b5ec5d584..f0e7ac94703 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -29,11 +29,11 @@ EndScriptData */ enum Says { - SAY_AGGRO = -1189011, - SAY_HEALTH1 = -1189012, - SAY_HEALTH2 = -1189013, - SAY_KILL = -1189014, - SAY_TRIGGER_VORREL = -1189015 + SAY_AGGRO = 0, + SAY_HEALTH1 = 1, + SAY_HEALTH2 = 2, + SAY_KILL = 3, + SAY_TRIGGER_VORREL = 0 }; enum Spells @@ -71,12 +71,12 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void KilledUnit(Unit* /*Victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) @@ -85,8 +85,8 @@ public: return; //Any other Actions to do with vorrel? setStandState? - if (Unit* vorrel = Unit::GetUnit(*me, instance->GetData64(DATA_VORREL))) - DoScriptText(SAY_TRIGGER_VORREL, vorrel); + if (Creature* vorrel = Creature::GetCreature(*me, instance->GetData64(DATA_VORREL))) + vorrel->AI()->Talk(SAY_TRIGGER_VORREL); } void UpdateAI(const uint32 diff) @@ -97,13 +97,13 @@ public: //If we are low on hp Do sayings if (!Yell60 && !HealthAbovePct(60)) { - DoScriptText(SAY_HEALTH1, me); + Talk(SAY_HEALTH1); Yell60 = true; } if (!Yell30 && !HealthAbovePct(30)) { - DoScriptText(SAY_HEALTH2, me); + Talk(SAY_HEALTH2); Yell30 = true; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 0aad2857a45..651ca453916 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -26,18 +26,19 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "scarlet_monastery.h" +#include "SpellInfo.h" enum Says { //Mograine says - SAY_MO_AGGRO = -1189005, - SAY_MO_KILL = -1189006, - SAY_MO_RESSURECTED = -1189007, + SAY_MO_AGGRO = 0, + SAY_MO_KILL = 1, + SAY_MO_RESSURECTED = 2, //Whitemane says - SAY_WH_INTRO = -1189008, - SAY_WH_KILL = -1189009, - SAY_WH_RESSURECT = -1189010, + SAY_WH_INTRO = 0, + SAY_WH_KILL = 1, + SAY_WH_RESSURECT = 2, }; enum Spells @@ -113,7 +114,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_MO_AGGRO, me); + Talk(SAY_MO_AGGRO); DoCast(me, SPELL_RETRIBUTIONAURA); me->CallForHelp(VISIBLE_RANGE); @@ -121,7 +122,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_MO_KILL, me); + Talk(SAY_MO_KILL); } void DamageTaken(Unit* /*doneBy*/, uint32 &damage) @@ -166,7 +167,7 @@ public: //When hit with ressurection say text if (spell->Id == SPELL_SCARLETRESURRECTION) { - DoScriptText(SAY_MO_RESSURECTED, me); + Talk(SAY_MO_RESSURECTED); _bFakeDeath = false; if (instance) @@ -275,12 +276,12 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_WH_INTRO, me); + Talk(SAY_WH_INTRO); } void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_WH_KILL, me); + Talk(SAY_WH_KILL); } void DamageTaken(Unit* /*attacker*/, uint32& damage) @@ -302,7 +303,7 @@ public: if (Unit* Mograine = Unit::GetUnit(*me, instance->GetData64(DATA_MOGRAINE))) { DoCast(Mograine, SPELL_SCARLETRESURRECTION); - DoScriptText(SAY_WH_RESSURECT, me); + Talk(SAY_WH_RESSURECT); _bCanResurrect = false; } } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index 3d3d9ae52ae..e65ab21b8cf 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -132,7 +132,7 @@ public: } } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { @@ -147,7 +147,7 @@ public: return 0; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == TYPE_MOGRAINE_AND_WHITE_EVENT) return encounter[0]; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp index 197ee9a5bfe..5151268b70d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp @@ -67,7 +67,10 @@ public: instance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0); if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS) + { + instance->SetData(TYPE_GANDLING, IN_PROGRESS); me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0); + } } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp index b6b5cc0acbd..e1cffbaf90d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp @@ -67,7 +67,10 @@ public: instance->SetData(DATA_LADYILLUCIABAROV_DEATH, 0); if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS) + { + instance->SetData(TYPE_GANDLING, IN_PROGRESS); me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0); + } } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp index 406b1a6b10d..1768584cb25 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp @@ -74,7 +74,10 @@ public: instance->SetData(DATA_INSTRUCTORMALICIA_DEATH, 0); if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS) + { + instance->SetData(TYPE_GANDLING, IN_PROGRESS); me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0); + } } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp index 438c3c88bb4..3035688343c 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp @@ -63,7 +63,10 @@ public: instance->SetData(DATA_LORDALEXEIBAROV_DEATH, 0); if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS) + { + instance->SetData(TYPE_GANDLING, IN_PROGRESS); me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0); + } } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp index 64bbbbe9514..dfab9dd37df 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp @@ -67,7 +67,10 @@ public: instance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0); if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS) + { + instance->SetData(TYPE_GANDLING, IN_PROGRESS); me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0); + } } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp index 381a039d609..b3d42d4676a 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp @@ -69,7 +69,10 @@ public: instance->SetData(DATA_THERAVENIAN_DEATH, 0); if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS) + { + instance->SetData(TYPE_GANDLING, IN_PROGRESS); me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0); + } } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index c3b3724ec3d..f8a0c0010d2 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -128,21 +128,14 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { - if (type == TYPE_GANDLING) - { - if (IsBossDied[0] && IsBossDied[1] && IsBossDied[2] && IsBossDied[3] && IsBossDied[4] && IsBossDied[5]) - { - m_auiEncounter[0] = IN_PROGRESS; - return IN_PROGRESS; - } - } - - return 0; + return (type == TYPE_GANDLING && + IsBossDied[0] && IsBossDied[1] && IsBossDied[2] && + IsBossDied[3] && IsBossDied[4] && IsBossDied[5]) + ? IN_PROGRESS : 0; } }; - }; void AddSC_instance_scholomance() diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index b405f9eba85..5d9df239870 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -23,17 +23,19 @@ SDComment: SDCategory: Shadowfang Keep EndScriptData */ +#include "ScriptedCreature.h" #include "ScriptMgr.h" #include "InstanceScript.h" #include "shadowfang_keep.h" +#include "TemporarySummon.h" #define MAX_ENCOUNTER 4 enum eEnums { - SAY_BOSS_DIE_AD = -1033007, - SAY_BOSS_DIE_AS = -1033008, - SAY_ARCHMAGE = -1033009, + SAY_BOSS_DIE_AD = 0, + SAY_BOSS_DIE_AS = 0, + SAY_ARCHMAGE = 0, NPC_ASH = 3850, NPC_ADA = 3849, @@ -138,8 +140,8 @@ public: if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive()) { - DoScriptText(SAY_BOSS_DIE_AD, pAda); - DoScriptText(SAY_BOSS_DIE_AS, pAsh); + pAda->AI()->Talk(SAY_BOSS_DIE_AD); + pAsh->AI()->Talk(SAY_BOSS_DIE_AS); } } @@ -191,7 +193,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -256,7 +258,7 @@ public: summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); summon->SetReactState(REACT_DEFENSIVE); summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true); - DoScriptText(SAY_ARCHMAGE, summon); + summon->AI()->Talk(SAY_ARCHMAGE); uiTimer = 2000; uiPhase = 2; break; diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 9ee3428c7dd..c98148e645b 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -34,6 +34,7 @@ EndContentData */ #include "SpellAuraEffects.h" #include "ScriptedEscortAI.h" #include "shadowfang_keep.h" +#include "Player.h" /*###### ## npc_shadowfang_prisoner @@ -41,13 +42,13 @@ EndContentData */ enum eEnums { - SAY_FREE_AS = -1033000, - SAY_OPEN_DOOR_AS = -1033001, - SAY_POST_DOOR_AS = -1033002, - SAY_FREE_AD = -1033003, - SAY_OPEN_DOOR_AD = -1033004, - SAY_POST1_DOOR_AD = -1033005, - SAY_POST2_DOOR_AD = -1033006, + SAY_FREE_AS = 0, + SAY_OPEN_DOOR_AS = 1, + SAY_POST_DOOR_AS = 2, + SAY_FREE_AD = 0, + SAY_OPEN_DOOR_AD = 1, + SAY_POST1_DOOR_AD = 2, + SAY_POST2_DOOR_AD = 3, SPELL_UNLOCK = 6421, NPC_ASH = 3850, @@ -109,15 +110,15 @@ public: { case 0: if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_FREE_AS, me); + Talk(SAY_FREE_AS); else - DoScriptText(SAY_FREE_AD, me); + Talk(SAY_FREE_AD); break; case 10: if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_OPEN_DOOR_AS, me); + Talk(SAY_OPEN_DOOR_AS); else - DoScriptText(SAY_OPEN_DOOR_AD, me); + Talk(SAY_OPEN_DOOR_AD); break; case 11: if (uiNpcEntry == NPC_ASH) @@ -125,16 +126,16 @@ public: break; case 12: if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_POST_DOOR_AS, me); + Talk(SAY_POST_DOOR_AS); else - DoScriptText(SAY_POST1_DOOR_AD, me); + Talk(SAY_POST1_DOOR_AD); if (instance) instance->SetData(TYPE_FREE_NPC, DONE); break; case 13: if (uiNpcEntry != NPC_ASH) - DoScriptText(SAY_POST2_DOOR_AD, me); + Talk(SAY_POST2_DOOR_AD); break; } } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index 47c6b66f4bb..96e59a657a3 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "stratholme.h" +#include "Player.h" /*##### # Additional: diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 98df9638bae..2e4ec7278fc 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "InstanceScript.h" #include "stratholme.h" +#include "Player.h" #define GO_SERVICE_ENTRANCE 175368 #define GO_GAUNTLET_GATE1 175357 @@ -401,7 +402,7 @@ class instance_stratholme : public InstanceMapScript OUT_LOAD_INST_DATA_COMPLETE; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -425,7 +426,7 @@ class instance_stratholme : public InstanceMapScript return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 9b4591bc633..467b532163b 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -34,6 +34,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "stratholme.h" #include "Group.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist) diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp index e0987961f7e..624e5460213 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp @@ -193,7 +193,7 @@ public: State = data; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == EVENT_STATE) return State; diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp index 83ff86f5b88..040e2153c2d 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "sunken_temple.h" +#include "Player.h" /*##### # at_malfurion_Stormrage_trigger diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index c763cb69dec..3e9d2e991fc 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -28,41 +28,37 @@ EndScriptData */ enum Quotes { - YELL_INTRO = -1580017, - YELL_INTRO_BREAK_ICE = -1580018, - YELL_INTRO_CHARGE = -1580019, - YELL_INTRO_KILL_MADRIGOSA = -1580020, - YELL_INTRO_TAUNT = -1580021, - - YELL_MADR_ICE_BARRIER = -1580031, - YELL_MADR_INTRO = -1580032, - YELL_MADR_ICE_BLOCK = -1580033, - YELL_MADR_TRAP = -1580034, - YELL_MADR_DEATH = -1580035, - - YELL_AGGRO = -1580022, - YELL_KILL1 = -1580023, - YELL_KILL2 = -1580024, - YELL_KILL3 = -1580025, - YELL_LOVE1 = -1580026, - YELL_LOVE2 = -1580027, - YELL_LOVE3 = -1580028, - YELL_BERSERK = -1580029, - YELL_DEATH = -1580030 + YELL_INTRO = 0, + YELL_INTRO_BREAK_ICE = 1, + YELL_INTRO_CHARGE = 2, + YELL_INTRO_KILL_MADRIGOSA = 3, + YELL_INTRO_TAUNT = 4, + + YELL_AGGRO = 5, + YELL_KILL = 6, + YELL_LOVE = 7, + YELL_BERSERK = 8, + YELL_DEATH = 9, + + YELL_MADR_ICE_BARRIER = 0, + YELL_MADR_INTRO = 1, + YELL_MADR_ICE_BLOCK = 2, + YELL_MADR_TRAP = 3, + YELL_MADR_DEATH = 4, }; enum Spells { - SPELL_METEOR_SLASH = 45150, - SPELL_BURN = 46394, - SPELL_STOMP = 45185, - SPELL_BERSERK = 26662, - SPELL_DUAL_WIELD = 42459, - - SPELL_INTRO_FROST_BLAST = 45203, - SPELL_INTRO_FROSTBOLT = 44843, - SPELL_INTRO_ENCAPSULATE = 45665, - SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661 + SPELL_METEOR_SLASH = 45150, + SPELL_BURN = 46394, + SPELL_STOMP = 45185, + SPELL_BERSERK = 26662, + SPELL_DUAL_WIELD = 42459, + + SPELL_INTRO_FROST_BLAST = 45203, + SPELL_INTRO_FROSTBOLT = 44843, + SPELL_INTRO_ENCAPSULATE = 45665, + SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661 }; #define FELMYST 25038 @@ -122,7 +118,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(YELL_AGGRO, me); + Talk(YELL_AGGRO); if (instance) instance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); @@ -130,12 +126,12 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(YELL_KILL1, YELL_KILL2, YELL_KILL3), me); + Talk(YELL_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(YELL_DEATH, me); + Talk(YELL_DEATH); if (instance) { @@ -199,19 +195,19 @@ public: switch (IntroPhase) { case 0: - DoScriptText(YELL_MADR_ICE_BARRIER, Madrigosa); + Madrigosa->AI()->Talk(YELL_MADR_ICE_BARRIER); IntroPhaseTimer = 7000; ++IntroPhase; break; case 1: me->SetInFront(Madrigosa); Madrigosa->SetInFront(me); - DoScriptText(YELL_MADR_INTRO, Madrigosa, me); + Madrigosa->AI()->Talk(YELL_MADR_INTRO, me->GetGUID()); IntroPhaseTimer = 9000; ++IntroPhase; break; case 2: - DoScriptText(YELL_INTRO, me, Madrigosa); + Talk(YELL_INTRO, Madrigosa->GetGUID()); IntroPhaseTimer = 13000; ++IntroPhase; break; @@ -225,32 +221,32 @@ public: ++IntroPhase; break; case 4: - DoScriptText(YELL_INTRO_BREAK_ICE, me); + Talk(YELL_INTRO_BREAK_ICE); IntroPhaseTimer = 6000; ++IntroPhase; break; case 5: Madrigosa->CastSpell(me, SPELL_INTRO_ENCAPSULATE_CHANELLING, false); - DoScriptText(YELL_MADR_TRAP, Madrigosa); + Madrigosa->AI()->Talk(YELL_MADR_TRAP); DoCast(me, SPELL_INTRO_ENCAPSULATE); IntroPhaseTimer = 11000; ++IntroPhase; break; case 6: - DoScriptText(YELL_INTRO_CHARGE, me); + Talk(YELL_INTRO_CHARGE); IntroPhaseTimer = 5000; ++IntroPhase; break; case 7: me->Kill(Madrigosa); - DoScriptText(YELL_MADR_DEATH, Madrigosa); + Madrigosa->AI()->Talk(YELL_MADR_DEATH); me->SetFullHealth(); me->AttackStop(); IntroPhaseTimer = 4000; ++IntroPhase; break; case 8: - DoScriptText(YELL_INTRO_KILL_MADRIGOSA, me); + Talk(YELL_INTRO_KILL_MADRIGOSA); me->SetOrientation(0.14f); me->StopMoving(); Madrigosa->setDeathState(CORPSE); @@ -258,7 +254,7 @@ public: ++IntroPhase; break; case 9: - DoScriptText(YELL_INTRO_TAUNT, me); + Talk(YELL_INTRO_TAUNT); IntroPhaseTimer = 5000; ++IntroPhase; break; @@ -316,7 +312,7 @@ public: if (StompTimer <= diff) { - DoScriptText(RAND(YELL_LOVE1, YELL_LOVE2, YELL_LOVE3), me); + Talk(YELL_LOVE); DoCast(me->getVictim(), SPELL_STOMP); StompTimer = 30000; } else StompTimer -= diff; @@ -336,7 +332,7 @@ public: if (BerserkTimer < diff && !Enraged) { - DoScriptText(YELL_BERSERK, me); + Talk(YELL_BERSERK); DoCast(me, SPELL_BERSERK); Enraged = true; } else BerserkTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 34548ec9116..23a83a7ee8f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -24,38 +24,31 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "sunwell_plateau.h" +#include "SpellInfo.h" enum Quotes { - //Alytesh - YELL_CANFLAGRATION = -1580044, - YELL_SISTER_SACROLASH_DEAD = -1580045, - YELL_ALY_KILL_1 = -1580046, - YELL_ALY_KILL_2 = -1580047, - YELL_ALY_DEAD = -1580048, - YELL_BERSERK = -1580049, - - //Sacrolash - YELL_SHADOW_NOVA = -1580050, - YELL_SISTER_ALYTHESS_DEAD = -1580051, - YELL_SAC_KILL_1 = -1580052, - YELL_SAC_KILL_2 = -1580053, - SAY_SAC_DEAD = -1580054, - YELL_ENRAGE = -1580055, - - //Intro - YELL_INTRO_SAC_1 = -1580056, - YELL_INTRO_ALY_2 = -1580057, - YELL_INTRO_SAC_3 = -1580058, - YELL_INTRO_ALY_4 = -1580059, - YELL_INTRO_SAC_5 = -1580060, - YELL_INTRO_ALY_6 = -1580061, - YELL_INTRO_SAC_7 = -1580062, - YELL_INTRO_ALY_8 = -1580063, - - //Emote - EMOTE_SHADOW_NOVA = -1580064, - EMOTE_CONFLAGRATION = -1580065 + YELL_INTRO_SAC_1 = 0, + YELL_INTRO_SAC_3 = 1, + YELL_INTRO_SAC_5 = 2, + YELL_INTRO_SAC_7 = 3, + YELL_SAC_DEAD = 4, + EMOTE_SHADOW_NOVA = 5, + YELL_ENRAGE = 6, + YELL_SISTER_ALYTHESS_DEAD = 7, + YELL_SAC_KILL = 8, + YELL_SHADOW_NOVA = 9, + + YELL_INTRO_ALY_2 = 0, + YELL_INTRO_ALY_4 = 1, + YELL_INTRO_ALY_6 = 2, + YELL_INTRO_ALY_8 = 3, + EMOTE_CONFLAGRATION = 4, + YELL_ALY_KILL = 5, + YELL_ALY_DEAD = 6, + YELL_SISTER_SACROLASH_DEAD = 7, + YELL_CANFLAGRATION = 8, + YELL_BERSERK = 9, }; enum Spells @@ -164,7 +157,7 @@ public: void KilledUnit(Unit* /*victim*/) { if (rand()%4 == 0) - DoScriptText(RAND(YELL_SAC_KILL_1, YELL_SAC_KILL_2), me); + Talk(YELL_SAC_KILL); } void JustDied(Unit* /*killer*/) @@ -172,7 +165,7 @@ public: // only if ALY death if (SisterDeath) { - DoScriptText(SAY_SAC_DEAD, me); + Talk(YELL_SAC_DEAD); if (instance) instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); @@ -234,7 +227,7 @@ public: Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); if (Temp && Temp->isDead()) { - DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me); + Talk(YELL_SISTER_ALYTHESS_DEAD); DoCast(me, SPELL_EMPOWER); me->InterruptSpell(CURRENT_GENERIC_SPELL); SisterDeath = true; @@ -274,8 +267,8 @@ public: if (!SisterDeath) { if (target) - DoScriptText(EMOTE_SHADOW_NOVA, me, target); - DoScriptText(YELL_SHADOW_NOVA, me); + Talk(EMOTE_SHADOW_NOVA, target->GetGUID()); + Talk(YELL_SHADOW_NOVA); } ShadownovaTimer = 30000+(rand()%5000); } @@ -323,7 +316,7 @@ public: if (EnrageTimer < diff && !Enraged) { me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoScriptText(YELL_ENRAGE, me); + Talk(YELL_ENRAGE); DoCast(me, SPELL_ENRAGE); Enraged = true; } else EnrageTimer -= diff; @@ -456,7 +449,7 @@ public: { if (rand()%4 == 0) { - DoScriptText(RAND(YELL_ALY_KILL_1, YELL_ALY_KILL_2), me); + Talk(YELL_ALY_KILL); } } @@ -464,7 +457,7 @@ public: { if (SisterDeath) { - DoScriptText(YELL_ALY_DEAD, me); + Talk(YELL_ALY_DEAD); if (instance) instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); @@ -527,24 +520,24 @@ public: case 0: return 0; case 1: if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_1, Sacrolash); + Sacrolash->AI()->Talk(YELL_INTRO_SAC_1); return 1000; - case 2: DoScriptText(YELL_INTRO_ALY_2, me); return 1000; + case 2: Talk(YELL_INTRO_ALY_2); return 1000; case 3: if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_3, Sacrolash); + Sacrolash->AI()->Talk(YELL_INTRO_SAC_3); return 2000; - case 4: DoScriptText(YELL_INTRO_ALY_4, me); return 1000; + case 4: Talk(YELL_INTRO_ALY_4); return 1000; case 5: if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_5, Sacrolash); + Sacrolash->AI()->Talk(YELL_INTRO_SAC_5); return 2000; - case 6: DoScriptText(YELL_INTRO_ALY_6, me); return 1000; + case 6: Talk(YELL_INTRO_ALY_6); return 1000; case 7: if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_7, Sacrolash); + Sacrolash->AI()->Talk(YELL_INTRO_SAC_7); return 3000; - case 8: DoScriptText(YELL_INTRO_ALY_8, me); return 900000; + case 8: Talk(YELL_INTRO_ALY_8); return 900000; } return 10000; } @@ -567,7 +560,7 @@ public: Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); if (Temp && Temp->isDead()) { - DoScriptText(YELL_SISTER_SACROLASH_DEAD, me); + Talk(YELL_SISTER_SACROLASH_DEAD); DoCast(me, SPELL_EMPOWER); me->InterruptSpell(CURRENT_GENERIC_SPELL); SisterDeath = true; @@ -621,8 +614,8 @@ public: if (!SisterDeath) { if (target) - DoScriptText(EMOTE_CONFLAGRATION, me, target); - DoScriptText(YELL_CANFLAGRATION, me); + Talk(EMOTE_CONFLAGRATION, target->GetGUID()); + Talk(YELL_CANFLAGRATION); } BlazeTimer = 4000; @@ -660,7 +653,7 @@ public: if (EnrageTimer < diff && !Enraged) { me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoScriptText(YELL_BERSERK, me); + Talk(YELL_BERSERK); DoCast(me, SPELL_ENRAGE); Enraged = true; } else EnrageTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index bc841d76714..35fabb7a195 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -31,14 +31,13 @@ EndScriptData */ enum Yells { - YELL_BIRTH = -1580036, - YELL_KILL1 = -1580037, - YELL_KILL2 = -1580038, - YELL_BREATH = -1580039, - YELL_TAKEOFF = -1580040, - YELL_BERSERK = -1580041, - YELL_DEATH = -1580042, - YELL_KALECGOS = -1580043, // after felmyst's death spawned and say this + YELL_BIRTH = 0, + YELL_KILL = 1, + YELL_BREATH = 2, + YELL_TAKEOFF = 3, + YELL_BERSERK = 4, + YELL_DEATH = 5, + //YELL_KALECGOS = 6, Not used. After felmyst's death spawned and say this }; enum Spells @@ -181,17 +180,17 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(YELL_KILL1, YELL_KILL2), me); + Talk(YELL_KILL); } void JustRespawned() { - DoScriptText(YELL_BIRTH, me); + Talk(YELL_BIRTH); } void JustDied(Unit* /*killer*/) { - DoScriptText(YELL_DEATH, me); + Talk(YELL_DEATH); if (instance) instance->SetData(DATA_FELMYST_EVENT, DONE); @@ -279,7 +278,7 @@ public: me->GetMotionMaster()->Clear(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->StopMoving(); - DoScriptText(YELL_TAKEOFF, me); + Talk(YELL_TAKEOFF); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); break; case 1: @@ -424,7 +423,7 @@ public: switch (events.ExecuteEvent()) { case EVENT_BERSERK: - DoScriptText(YELL_BERSERK, me); + Talk(YELL_BERSERK); DoCast(me, SPELL_BERSERK, true); events.ScheduleEvent(EVENT_BERSERK, 10000); break; @@ -459,7 +458,7 @@ public: switch (events.ExecuteEvent()) { case EVENT_BERSERK: - DoScriptText(YELL_BERSERK, me); + Talk(YELL_BERSERK); DoCast(me, SPELL_BERSERK, true); break; case EVENT_FLIGHT_SEQUENCE: diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 3e503a547d8..c7db80c7f22 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -26,63 +26,57 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "sunwell_plateau.h" +#include "Player.h" +#include "WorldSession.h" enum Yells { - //Kalecgos dragon form - SAY_EVIL_AGGRO = -1580000, - SAY_EVIL_SPELL1 = -1580001, - SAY_EVIL_SPELL2 = -1580002, - SAY_EVIL_SLAY1 = -1580003, - SAY_EVIL_SLAY2 = -1580004, - SAY_EVIL_ENRAGE = -1580005, - - //Kalecgos humanoid form - SAY_GOOD_AGGRO = -1580006, - SAY_GOOD_NEAR_DEATH = -1580007, - SAY_GOOD_NEAR_DEATH2 = -1580008, - SAY_GOOD_PLRWIN = -1580009, - - //Sathrovarr - SAY_SATH_AGGRO = -1580010, - SAY_SATH_DEATH = -1580011, - SAY_SATH_SPELL1 = -1580012, - SAY_SATH_SPELL2 = -1580013, - SAY_SATH_SLAY1 = -1580014, - SAY_SATH_SLAY2 = -1580015, - SAY_SATH_ENRAGE = -1580016, + SAY_SATH_AGGRO = 0, + SAY_SATH_SLAY = 1, + SAY_SATH_DEATH = 2, + SAY_SATH_SPELL1 = 3, + SAY_SATH_SPELL2 = 4, + + SAY_EVIL_AGGRO = 0, + SAY_EVIL_SLAY = 1, + SAY_GOOD_PLRWIN = 2, + SAY_EVIL_ENRAGE = 3, + + SAY_GOOD_AGGRO = 0, + SAY_GOOD_NEAR_DEATH = 1, + SAY_GOOD_NEAR_DEATH2 = 2, }; enum Spells { - AURA_SUNWELL_RADIANCE = 45769, - AURA_SPECTRAL_EXHAUSTION = 44867, - AURA_SPECTRAL_REALM = 46021, - AURA_SPECTRAL_INVISIBILITY = 44801, - AURA_DEMONIC_VISUAL = 44800, - - SPELL_SPECTRAL_BLAST = 44869, - SPELL_TELEPORT_SPECTRAL = 46019, - SPELL_ARCANE_BUFFET = 45018, - SPELL_FROST_BREATH = 44799, - SPELL_TAIL_LASH = 45122, - - SPELL_BANISH = 44836, - SPELL_TRANSFORM_KALEC = 44670, - SPELL_ENRAGE = 44807, - - SPELL_CORRUPTION_STRIKE = 45029, - SPELL_AGONY_CURSE = 45032, - SPELL_SHADOW_BOLT = 45031, - - SPELL_HEROIC_STRIKE = 45026, - SPELL_REVITALIZE = 45027 + AURA_SUNWELL_RADIANCE = 45769, + AURA_SPECTRAL_EXHAUSTION = 44867, + AURA_SPECTRAL_REALM = 46021, + AURA_SPECTRAL_INVISIBILITY = 44801, + AURA_DEMONIC_VISUAL = 44800, + + SPELL_SPECTRAL_BLAST = 44869, + SPELL_TELEPORT_SPECTRAL = 46019, + SPELL_ARCANE_BUFFET = 45018, + SPELL_FROST_BREATH = 44799, + SPELL_TAIL_LASH = 45122, + + SPELL_BANISH = 44836, + SPELL_TRANSFORM_KALEC = 44670, + SPELL_ENRAGE = 44807, + + SPELL_CORRUPTION_STRIKE = 45029, + SPELL_AGONY_CURSE = 45032, + SPELL_SHADOW_BOLT = 45031, + + SPELL_HEROIC_STRIKE = 45026, + SPELL_REVITALIZE = 45027 }; enum SWPActions { - DO_ENRAGE = 1, - DO_BANISH = 2, + DO_ENRAGE = 1, + DO_BANISH = 2, }; #define GO_FAILED "You are unable to use this currently." @@ -358,7 +352,7 @@ public: void EnterCombat(Unit* /*who*/) { me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_EVIL_AGGRO, me); + Talk(SAY_EVIL_AGGRO); DoZoneInCombat(); if (instance) @@ -367,7 +361,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_EVIL_SLAY1, SAY_EVIL_SLAY2), me); + Talk(SAY_EVIL_SLAY); } void MovementInform(uint32 type, uint32 /*id*/) @@ -406,7 +400,7 @@ public: TalkTimer = 1000; break; case 2: - DoScriptText(SAY_GOOD_PLRWIN, me); + Talk(SAY_GOOD_PLRWIN); TalkTimer = 10000; break; case 3: @@ -424,7 +418,7 @@ public: switch (TalkSequence) { case 1: - DoScriptText(SAY_EVIL_ENRAGE, me); + Talk(SAY_EVIL_ENRAGE); TalkTimer = 3000; break; case 2: @@ -503,20 +497,20 @@ public: switch (YellSequence) { case 0: - DoScriptText(SAY_GOOD_AGGRO, me); + Talk(SAY_GOOD_AGGRO); ++YellSequence; break; case 1: if (HealthBelowPct(50)) { - DoScriptText(SAY_GOOD_NEAR_DEATH, me); + Talk(SAY_GOOD_NEAR_DEATH); ++YellSequence; } break; case 2: if (HealthBelowPct(10)) { - DoScriptText(SAY_GOOD_NEAR_DEATH2, me); + Talk(SAY_GOOD_NEAR_DEATH2); ++YellSequence; } break; @@ -640,7 +634,7 @@ public: me->AddThreat(Kalec, 100.0f); Kalec->setActive(true); } - DoScriptText(SAY_SATH_AGGRO, me); + Talk(SAY_SATH_AGGRO); } void DamageTaken(Unit* done_by, uint32 &damage) @@ -662,12 +656,12 @@ public: EnterEvadeMode(); return; } - DoScriptText(RAND(SAY_SATH_SLAY1, SAY_SATH_SLAY2), me); + Talk(SAY_SATH_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_SATH_DEATH, me); + Talk(SAY_SATH_DEATH); me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); TeleportAllPlayersBack(); if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) @@ -779,7 +773,7 @@ public: if (ShadowBoltTimer <= diff) { - if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me); + if (!(rand()%5))Talk(SAY_SATH_SPELL1); DoCast(me, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000+(rand()%3000); } else ShadowBoltTimer -= diff; @@ -794,7 +788,7 @@ public: if (CorruptionStrikeTimer <= diff) { - if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me); + if (!(rand()%5))Talk(SAY_SATH_SPELL2); DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE); CorruptionStrikeTimer = 13000; } else CorruptionStrikeTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 096f6daaec2..c2552963b0e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -28,50 +28,39 @@ EndScriptData */ #include "ScriptedCreature.h" #include "sunwell_plateau.h" #include <math.h> +#include "Player.h" /*** Speech and sounds***/ enum Yells { - // These are used throughout Sunwell and Magisters(?). Players can hear this while running through the instances. - SAY_KJ_OFFCOMBAT1 = -1580066, - SAY_KJ_OFFCOMBAT2 = -1580067, - SAY_KJ_OFFCOMBAT3 = -1580068, - SAY_KJ_OFFCOMBAT4 = -1580069, - SAY_KJ_OFFCOMBAT5 = -1580070, - - // Encounter speech and sounds - SAY_KJ_EMERGE = -1580071, - SAY_KJ_SLAY1 = -1580072, - SAY_KJ_SLAY2 = -1580073, - SAY_KJ_REFLECTION1 = -1580074, - SAY_KJ_REFLECTION2 = -1580075, - SAY_KJ_DARKNESS1 = -1580076, - SAY_KJ_DARKNESS2 = -1580077, - SAY_KJ_DARKNESS3 = -1580078, - SAY_KJ_PHASE3 = -1580079, - SAY_KJ_PHASE4 = -1580080, - SAY_KJ_PHASE5 = -1580081, - SAY_KJ_DEATH = -1580093, - EMOTE_KJ_DARKNESS = -1580094, - - /*** Kalecgos - Anveena speech at the beginning of Phase 5; Anveena's sacrifice ***/ - SAY_KALECGOS_AWAKEN = -1580082, - SAY_ANVEENA_IMPRISONED = -1580083, - SAY_KALECGOS_LETGO = -1580084, - SAY_ANVEENA_LOST = -1580085, - SAY_KALECGOS_FOCUS = -1580086, - SAY_ANVEENA_KALEC = -1580087, - SAY_KALECGOS_FATE = -1580088, - SAY_ANVEENA_GOODBYE = -1580089, - SAY_KALECGOS_GOODBYE = -1580090, - SAY_KALECGOS_ENCOURAGE = -1580091, - - /*** Kalecgos says throughout the fight ***/ - SAY_KALECGOS_JOIN = -1580092, - SAY_KALEC_ORB_READY1 = -1580095, - SAY_KALEC_ORB_READY2 = -1580096, - SAY_KALEC_ORB_READY3 = -1580097, - SAY_KALEC_ORB_READY4 = -1580098 + SAY_KJ_OFFCOMBAT = 0, + + SAY_KALECGOS_ENCOURAGE = 0, + SAY_KALECGOS_READY1 = 1, + SAY_KALECGOS_READY2 = 2, + SAY_KALECGOS_READY3 = 3, + SAY_KALECGOS_READY4 = 4, + SAY_KALECGOS_AWAKEN = 5, + SAY_KALECGOS_LETGO = 6, + SAY_KALECGOS_FOCUS = 7, + SAY_KALECGOS_FATE = 8, + SAY_KALECGOS_GOODBYE = 9, + SAY_KALECGOS_JOIN = 10, + + SAY_KJ_DEATH = 0, + SAY_KJ_SLAY = 1, + SAY_KJ_REFLECTION = 2, + SAY_KJ_EMERGE = 3, + SAY_KJ_DARKNESS = 4, + SAY_KJ_PHASE3 = 5, + SAY_KJ_PHASE4 = 6, + SAY_KJ_PHASE5 = 7, + EMOTE_KJ_DARKNESS = 8, + + SAY_ANVEENA_IMPRISONED = 0, + SAY_ANVEENA_LOST = 1, + SAY_ANVEENA_KALEC = 2, + SAY_ANVEENA_GOODBYE = 3, }; /*** Spells used during the encounter ***/ @@ -321,7 +310,7 @@ public: pOrb->Refresh(); } } - DoScriptText(SAY_KALECGOS_ENCOURAGE, me); + Talk(SAY_KALECGOS_ENCOURAGE); } else { @@ -337,10 +326,10 @@ public: ++EmpowerCount; switch (EmpowerCount) { - case 1: DoScriptText(SAY_KALEC_ORB_READY1, me); break; - case 2: DoScriptText(SAY_KALEC_ORB_READY2, me); break; - case 3: DoScriptText(SAY_KALEC_ORB_READY3, me); break; - case 4: DoScriptText(SAY_KALEC_ORB_READY4, me); break; + case 1: Talk(SAY_KALECGOS_READY1); break; + case 2: Talk(SAY_KALECGOS_READY2); break; + case 3: Talk(SAY_KALECGOS_READY3); break; + case 4: Talk(SAY_KALECGOS_READY4); break; } } } @@ -468,7 +457,7 @@ public: if (uiRandomSayTimer < diff) { if (instance && instance->GetData(DATA_MURU_EVENT) != DONE && instance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) - DoScriptText(RAND(SAY_KJ_OFFCOMBAT1, SAY_KJ_OFFCOMBAT2, SAY_KJ_OFFCOMBAT3, SAY_KJ_OFFCOMBAT4, SAY_KJ_OFFCOMBAT5), me); + Talk(SAY_KJ_OFFCOMBAT); uiRandomSayTimer = 30000; } else uiRandomSayTimer -= diff; @@ -612,7 +601,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_KJ_DEATH, me); + Talk(SAY_KJ_DEATH); summons.DespawnAll(); if (instance) @@ -621,7 +610,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KJ_SLAY1, SAY_KJ_SLAY2), me); + Talk(SAY_KJ_SLAY); } void EnterEvadeMode() @@ -656,7 +645,7 @@ public: void CastSinisterReflection() { - DoScriptText(RAND(SAY_KJ_REFLECTION1, SAY_KJ_REFLECTION2), me); + Talk(SAY_KJ_REFLECTION); for (uint8 i = 0; i < 4; ++i) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true, -SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)) @@ -716,8 +705,8 @@ public: { SpeechTimer = 0; if (instance) - if (Creature* pSpeechCreature = Unit::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) - DoScriptText(Speeches[speechCount].textid, pSpeechCreature); + if (Creature* speechCreature = Unit::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) + speechCreature->AI()->Talk(Speeches[speechCount].textid); if (speechCount == 12) if (Creature* pAnveena = Unit::GetCreature(*me, instance->GetData64(DATA_ANVEENA))) pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); @@ -798,7 +787,7 @@ public: // Begins to channel for 8 seconds, then deals 50'000 damage to all raid members. if (!IsInDarkness) { - DoScriptText(EMOTE_KJ_DARKNESS, me); + Talk(EMOTE_KJ_DARKNESS); DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); ChangeTimers(true, 9000); Timer[TIMER_DARKNESS] = 8750; @@ -812,7 +801,7 @@ public: Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(40000, 70000); IsInDarkness = false; DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE); - DoScriptText(RAND(SAY_KJ_DARKNESS1, SAY_KJ_DARKNESS2, SAY_KJ_DARKNESS3), me); + Talk(SAY_KJ_DARKNESS); } Timer[TIMER_SOUL_FLAY] = 9000; } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 9fd0a5eb5d8..d23ca834f86 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -24,6 +24,8 @@ SDComment: all sounds, black hole effect triggers to often (46228) #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "sunwell_plateau.h" +#include "Player.h" +#include "SpellInfo.h" // Muru & Entropius's spells enum Spells diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index bea73837304..c4bb41036bc 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "sunwell_plateau.h" +#include "Player.h" #define MAX_ENCOUNTER 6 @@ -121,7 +122,7 @@ public: return false; } - Player* GetPlayerInMap() + Player const * GetPlayerInMap() const { Map::PlayerList const& players = instance->GetPlayers(); @@ -181,7 +182,7 @@ public: } } - uint32 GetData(uint32 id) + uint32 GetData(uint32 id) const { switch (id) { @@ -195,7 +196,7 @@ public: return 0; } - uint64 GetData64(uint32 id) + uint64 GetData64(uint32 id) const { switch (id) { @@ -214,8 +215,8 @@ public: case DATA_ANVEENA: return Anveena; case DATA_KALECGOS_KJ: return KalecgosKJ; case DATA_PLAYER_GUID: - Player* Target = GetPlayerInMap(); - return Target->GetGUID(); + Player const* target = GetPlayerInMap(); + return target ? target->GetGUID() : 0; } return 0; } diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 74fad4f94d8..0b7a62f6563 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -29,6 +29,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "uldaman.h" +#include "Player.h" #define SAY_AGGRO "Who dares awaken Archaedas? Who dares the wrath of the makers!" #define SOUND_AGGRO 5855 diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp index c05a36f93a7..1537f0eeb88 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp @@ -26,11 +26,13 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#define SAY_AGGRO -1070000 - -#define SPELL_ARCINGSMASH 8374 -#define SPELL_KNOCKAWAY 10101 -#define SPELL_WSTOMP 11876 +enum Ironaya +{ + SAY_AGGRO = 0, + SPELL_ARCINGSMASH = 8374, + SPELL_KNOCKAWAY = 10101, + SPELL_WSTOMP = 11876, +}; class boss_ironaya : public CreatureScript { @@ -58,7 +60,7 @@ class boss_ironaya : public CreatureScript void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 uiDiff) diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index ee82da668f8..efbc4f75ae1 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -466,20 +466,27 @@ class instance_uldaman : public InstanceMapScript } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { - if (identifier == 0) return uiWhoWokeuiArchaedasGUID; - if (identifier == 1) return vVaultWalker[0]; // VaultWalker1 - if (identifier == 2) return vVaultWalker[1]; // VaultWalker2 - if (identifier == 3) return vVaultWalker[2]; // VaultWalker3 - if (identifier == 4) return vVaultWalker[3]; // VaultWalker4 - - if (identifier == 5) return vEarthenGuardian[0]; - if (identifier == 6) return vEarthenGuardian[1]; - if (identifier == 7) return vEarthenGuardian[2]; - if (identifier == 8) return vEarthenGuardian[3]; - if (identifier == 9) return vEarthenGuardian[4]; - if (identifier == 10) return vEarthenGuardian[5]; + switch (identifier) + { + case 0: + return uiWhoWokeuiArchaedasGUID; + case 1: + case 2: + case 3: + case 4: + return vVaultWalker.at(identifier - 1); + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + return vEarthenGuardian.at(identifier - 5); + default: + break; + } return 0; } // end GetData64 diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp index 2b8d4e37b65..d86da3efce5 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp @@ -33,6 +33,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "uldaman.h" +#include "Player.h" /*###### ## mob_jadespine_basilisk diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index a8afd19cd96..f7f279cf716 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -26,7 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "zulaman.h" -//#include "spell.h" +#include "SpellInfo.h" #define YELL_AGGRO "Get on your knees and bow to da fang and claw!" #define SOUND_AGGRO 12020 diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 8a102757036..ed10dec97dd 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -31,16 +31,15 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1568000, - SAY_FIRE_BOMBS = -1568001, - SAY_SUMMON_HATCHER = -1568002, - SAY_ALL_EGGS = -1568003, - SAY_BERSERK = -1568004, - SAY_SLAY_1 = -1568005, - SAY_SLAY_2 = -1568006, - SAY_DEATH = -1568007, - SAY_EVENT_STRANGERS = -1568008, - SAY_EVENT_FRIENDS = -1568009, + SAY_AGGRO = 0, + SAY_FIRE_BOMBS = 1, + SAY_SUMMON_HATCHER = 2, + SAY_ALL_EGGS = 3, + SAY_BERSERK = 4, + SAY_SLAY = 5, + SAY_DEATH = 6, + SAY_EVENT_STRANGERS = 7, + SAY_EVENT_FRIENDS = 8, // Jan'alai SPELL_FLAME_BREATH = 43140, @@ -163,7 +162,7 @@ class boss_janalai : public CreatureScript void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(DATA_JANALAIEVENT, DONE); @@ -171,7 +170,7 @@ class boss_janalai : public CreatureScript void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); + Talk(SAY_SLAY); } void EnterCombat(Unit* /*who*/) @@ -179,7 +178,7 @@ class boss_janalai : public CreatureScript if (instance) instance->SetData(DATA_JANALAIEVENT, IN_PROGRESS); - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); // DoZoneInCombat(); } @@ -352,7 +351,7 @@ class boss_janalai : public CreatureScript } else { - DoScriptText(SAY_BERSERK, me); + Talk(SAY_BERSERK); DoCast(me, SPELL_BERSERK, true); EnrageTimer = 300000; } @@ -360,7 +359,7 @@ class boss_janalai : public CreatureScript if (BombTimer <= diff) { - DoScriptText(SAY_FIRE_BOMBS, me); + Talk(SAY_FIRE_BOMBS); me->AttackStop(); me->GetMotionMaster()->Clear(); @@ -393,7 +392,7 @@ class boss_janalai : public CreatureScript { if (HealthBelowPct(35)) { - DoScriptText(SAY_ALL_EGGS, me); + Talk(SAY_ALL_EGGS); me->AttackStop(); me->GetMotionMaster()->Clear(); @@ -407,7 +406,7 @@ class boss_janalai : public CreatureScript { if (HatchAllEggs(0)) { - DoScriptText(SAY_SUMMON_HATCHER, me); + Talk(SAY_SUMMON_HATCHER); me->SummonCreature(MOB_AMANI_HATCHER, hatcherway[0][0][0], hatcherway[0][0][1], hatcherway[0][0][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); me->SummonCreature(MOB_AMANI_HATCHER, hatcherway[1][0][0], hatcherway[1][0][1], hatcherway[1][0][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); HatcherTimer = 90000; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index 8fb3dd55077..5aa74fbbe89 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "zulaman.h" +#include "SpellInfo.h" //Speech const char* YELL_TRANSFORM_TO_LYNX = "Let me introduce to you my new bruddahs: fang and claw!"; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 235bec7cc8a..7273ca99c7c 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -26,6 +26,8 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "zulaman.h" +#include "Player.h" +#include "TemporarySummon.h" #define MAX_ENCOUNTER 6 #define RAND_VENDOR 2 @@ -282,7 +284,7 @@ class instance_zulaman : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index f0bea065eb6..61c7bda00ac 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -31,6 +31,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "zulaman.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ## npc_forest_frog diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index 104d479383b..8d17a18bb1b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -113,7 +113,7 @@ class instance_zulgurub : public InstanceMapScript } } - uint32 GetData(uint32 uiType) + uint32 GetData(uint32 uiType) const { switch (uiType) { @@ -137,7 +137,7 @@ class instance_zulgurub : public InstanceMapScript return 0; } - uint64 GetData64(uint32 uiData) + uint64 GetData64(uint32 uiData) const { switch (uiData) { @@ -163,4 +163,4 @@ class instance_zulgurub : public InstanceMapScript void AddSC_instance_zulgurub() { new instance_zulgurub(); -}
\ No newline at end of file +} diff --git a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp index b0d59fe8b5a..7f96706f48e 100644 --- a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp +++ b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_professor_phizzlethorpe diff --git a/src/server/scripts/EasternKingdoms/blasted_lands.cpp b/src/server/scripts/EasternKingdoms/blasted_lands.cpp index 75109f3a2f6..47fb8298ca7 100644 --- a/src/server/scripts/EasternKingdoms/blasted_lands.cpp +++ b/src/server/scripts/EasternKingdoms/blasted_lands.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*###### ## npc_deathly_usher diff --git a/src/server/scripts/EasternKingdoms/burning_steppes.cpp b/src/server/scripts/EasternKingdoms/burning_steppes.cpp index eec747d6d73..ba1d339730a 100644 --- a/src/server/scripts/EasternKingdoms/burning_steppes.cpp +++ b/src/server/scripts/EasternKingdoms/burning_steppes.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*###### ## npc_ragged_john diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp index e5af5344dc1..fbb98979e77 100644 --- a/src/server/scripts/EasternKingdoms/duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/duskwood.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" enum Yells { diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp index 7ca76e38fce..c9b60f847e8 100644 --- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp @@ -33,6 +33,8 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "WorldSession.h" class mobs_ghoul_flayer : public CreatureScript { diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index d69ae3454b4..f62273e583d 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -35,6 +35,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## Quest 9686 Second Trial diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp index 9793c6fd31c..5d97735ab5d 100644 --- a/src/server/scripts/EasternKingdoms/ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp @@ -34,6 +34,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## npc_budd_nedreck diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp index a6d01f0ca93..544ea0fd175 100644 --- a/src/server/scripts/EasternKingdoms/hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_00x09hl @@ -38,11 +39,11 @@ EndContentData */ enum eOOX { - SAY_OOX_START = -1000287, - SAY_OOX_AGGRO1 = -1000288, - SAY_OOX_AGGRO2 = -1000289, - SAY_OOX_AMBUSH = -1000290, - SAY_OOX_END = -1000292, + SAY_OOX_START = 0, + SAY_OOX_AGGRO = 1, + SAY_OOX_AMBUSH = 3, + SAY_OOX_AMBUSH_REPLY = 4, + SAY_OOX_END = 5, QUEST_RESQUE_OOX_09 = 836, @@ -69,7 +70,7 @@ public: else if (player->GetTeam() == HORDE) creature->setFaction(FACTION_ESCORTEE_H); - DoScriptText(SAY_OOX_START, creature, player); + creature->AI()->Talk(SAY_OOX_START, player->GetGUID()); if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hl::npc_00x09hlAI, creature->AI())) pEscortAI->Start(false, false, player->GetGUID(), quest); @@ -93,13 +94,13 @@ public: switch (waypointId) { case 26: - DoScriptText(SAY_OOX_AMBUSH, me); + Talk(SAY_OOX_AMBUSH); break; case 43: - DoScriptText(SAY_OOX_AMBUSH, me); + Talk(SAY_OOX_AMBUSH); break; case 64: - DoScriptText(SAY_OOX_END, me); + Talk(SAY_OOX_END); if (Player* player = GetPlayerForEscort()) player->GroupEventHappens(QUEST_RESQUE_OOX_09, me); break; @@ -136,10 +137,7 @@ public: if (who->GetEntry() == NPC_MARAUDING_OWL || who->GetEntry() == NPC_VILE_AMBUSHER) return; - if (rand()%1) - DoScriptText(SAY_OOX_AGGRO1, me); - else - DoScriptText(SAY_OOX_AGGRO2, me); + Talk(SAY_OOX_AGGRO); } void JustSummoned(Creature* summoned) @@ -155,13 +153,13 @@ public: enum eRinji { - SAY_RIN_FREE = -1000403, //from here - SAY_RIN_BY_OUTRUNNER = -1000404, - SAY_RIN_HELP_1 = -1000405, - SAY_RIN_HELP_2 = -1000406, //to here, are used also by 6182 but this is wrong... - SAY_RIN_COMPLETE = -1000407, - SAY_RIN_PROGRESS_1 = -1000408, - SAY_RIN_PROGRESS_2 = -1000409, + SAY_RIN_BY_OUTRUNNER = 0, + + SAY_RIN_FREE = 0, //from here + SAY_RIN_HELP = 1, + SAY_RIN_COMPLETE = 2, + SAY_RIN_PROGRESS_1 = 3, + SAY_RIN_PROGRESS_2 = 4, QUEST_RINJI_TRAPPED = 2742, NPC_RANGER = 2694, @@ -242,7 +240,8 @@ public: { if (who->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner) { - DoScriptText(SAY_RIN_BY_OUTRUNNER, who); + if (Creature* talker = who->ToCreature()) + talker->AI()->Talk(SAY_RIN_BY_OUTRUNNER); m_bIsByOutrunner = true; } @@ -250,7 +249,7 @@ public: return; //only if attacked and escorter is not in combat? - DoScriptText(RAND(SAY_RIN_HELP_1, SAY_RIN_HELP_2), me); + Talk(SAY_RIN_HELP); } } @@ -286,7 +285,7 @@ public: switch (waypointId) { case 1: - DoScriptText(SAY_RIN_FREE, me, player); + Talk(SAY_RIN_FREE, player->GetGUID()); break; case 7: DoSpawnAmbush(true); @@ -295,7 +294,7 @@ public: DoSpawnAmbush(false); break; case 17: - DoScriptText(SAY_RIN_COMPLETE, me, player); + Talk(SAY_RIN_COMPLETE, player->GetGUID()); player->GroupEventHappens(QUEST_RINJI_TRAPPED, me); SetRun(); m_uiPostEventCount = 1; @@ -319,11 +318,11 @@ public: switch (m_uiPostEventCount) { case 1: - DoScriptText(SAY_RIN_PROGRESS_1, me, player); + Talk(SAY_RIN_PROGRESS_1, player->GetGUID()); ++m_uiPostEventCount; break; case 2: - DoScriptText(SAY_RIN_PROGRESS_2, me, player); + Talk(SAY_RIN_PROGRESS_2, player->GetGUID()); m_uiPostEventCount = 0; break; } diff --git a/src/server/scripts/EasternKingdoms/ironforge.cpp b/src/server/scripts/EasternKingdoms/ironforge.cpp index 2915ee1f3cb..fdd9f5f9a86 100644 --- a/src/server/scripts/EasternKingdoms/ironforge.cpp +++ b/src/server/scripts/EasternKingdoms/ironforge.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*###### ## npc_royal_historian_archesonus diff --git a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp index e448ccda14c..c3a725f2f45 100644 --- a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp @@ -30,6 +30,9 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" +#include "Pet.h" +#include "SpellInfo.h" /*###### ## npc_converted_sentry diff --git a/src/server/scripts/EasternKingdoms/loch_modan.cpp b/src/server/scripts/EasternKingdoms/loch_modan.cpp index 4e3aaae71a1..0937e3cbb30 100644 --- a/src/server/scripts/EasternKingdoms/loch_modan.cpp +++ b/src/server/scripts/EasternKingdoms/loch_modan.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*###### ## npc_mountaineer_pebblebitty diff --git a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp index 2473fec899a..f04b0111da7 100644 --- a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp @@ -24,6 +24,7 @@ Script Data End */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" enum eCorporalKeeshan { diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp index 954f21f73f5..28af25d39de 100644 --- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp +++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp @@ -29,6 +29,8 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" +#include "SpellInfo.h" /*####### # npc_blood_knight_stillblade diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp index b2cd3b16e7b..905d34221ed 100644 --- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_deathstalker_erland diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp index 560214d4085..188f2c77fa1 100644 --- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp @@ -37,6 +37,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_archmage_malin diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp index 40f046a5075..2217eba7d1b 100644 --- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp +++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp @@ -29,6 +29,8 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ## mob_yenniku diff --git a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp index 4c81380fb60..4997fc49da9 100644 --- a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp +++ b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_galen_goodward diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp index 70f9f93c7a7..041f5976a6e 100644 --- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" /*###### ## npc_calvin_montague diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index 0d44db01592..05938452520 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -32,6 +32,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*###### ## npc_lady_sylvanas_windrunner @@ -40,8 +41,8 @@ EndContentData */ enum Sylvanas { QUEST_JOURNEY_TO_UNDERCITY = 9180, - SAY_LAMENT_END = -1000196, - EMOTE_LAMENT_END = -1000197, + EMOTE_LAMENT_END = 0, + SAY_LAMENT_END = 1, SOUND_CREDIT = 10896, ENTRY_HIGHBORNE_LAMENTER = 21628, @@ -152,8 +153,8 @@ public: LamentEventTimer = 2000; if (!me->HasAura(SPELL_SYLVANAS_CAST)) { - DoScriptText(SAY_LAMENT_END, me); - DoScriptText(EMOTE_LAMENT_END, me); + Talk(SAY_LAMENT_END); + Talk(EMOTE_LAMENT_END); LamentEvent = false; } } else LamentEventTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp index 31dea10453a..1c2f2624b34 100644 --- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp @@ -34,6 +34,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## npcs_dithers_and_arbington diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp index 478c5f6c0d6..c6cf1b4361c 100644 --- a/src/server/scripts/EasternKingdoms/westfall.cpp +++ b/src/server/scripts/EasternKingdoms/westfall.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_daphne_stilwell diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp index 34e6e7c9ddf..98f7b0ac967 100644 --- a/src/server/scripts/EasternKingdoms/wetlands.cpp +++ b/src/server/scripts/EasternKingdoms/wetlands.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_tapoke_slim_jahn diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp index 763961271d8..28d033f9d48 100644 --- a/src/server/scripts/Events/childrens_week.cpp +++ b/src/server/scripts/Events/childrens_week.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellAuras.h" +#include "Player.h" enum Orphans { diff --git a/src/server/scripts/Events/event.cpp b/src/server/scripts/Events/event.cpp index 22334f8d365..d77ef2b78c1 100644 --- a/src/server/scripts/Events/event.cpp +++ b/src/server/scripts/Events/event.cpp @@ -15,8 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptPCH.h" - void AddSC_event_childrens_week(); void AddSC_event_scripts() diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp index 17b9aae732b..1ef15c0ca61 100644 --- a/src/server/scripts/Examples/example_creature.cpp +++ b/src/server/scripts/Examples/example_creature.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" // **** This script is designed as an example for others to build on **** // **** Please modify whatever you'd like to as this script is only for developement **** diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp index 20e4c5614e9..8cf0dad25d2 100644 --- a/src/server/scripts/Examples/example_escort.cpp +++ b/src/server/scripts/Examples/example_escort.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" enum eEnums { diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp index d6936c8fb9e..352c43fc1de 100644 --- a/src/server/scripts/Examples/example_gossip_codebox.cpp +++ b/src/server/scripts/Examples/example_gossip_codebox.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" #include <cstring> enum eEnums diff --git a/src/server/scripts/Examples/example_misc.cpp b/src/server/scripts/Examples/example_misc.cpp index 3aa4bac3f1e..5ff66c4a7ed 100644 --- a/src/server/scripts/Examples/example_misc.cpp +++ b/src/server/scripts/Examples/example_misc.cpp @@ -24,6 +24,7 @@ SDCategory: Script Examples EndScriptData */ #include "ScriptMgr.h" +#include "Player.h" enum eSay { diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index cc27392919f..35e61a5300d 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -26,6 +26,7 @@ #include "SpellAuras.h" #include "SpellAuraEffects.h" #include "SpellScript.h" +#include "Player.h" enum Spells { diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index a70d05fa0ef..9cc515c1b0d 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -20,6 +20,7 @@ #include "ScriptedGossip.h" #include "blackfathom_deeps.h" #include "ScriptedEscortAI.h" +#include "Player.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 236c7b1ba69..8df5c5cdfd4 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -212,7 +212,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -233,7 +233,7 @@ public: return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 1c91d78cd29..afd7603a506 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "hyjal.h" #include "SpellAuras.h" #include "hyjal_trash.h" +#include "Player.h" enum Texts { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 48dd847b190..3ab06642fb5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -33,6 +33,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "hyjalAI.h" +#include "Player.h" #define GOSSIP_ITEM_BEGIN_ALLY "My companions and I are with you, Lady Proudmoore." #define GOSSIP_ITEM_ANETHERON "We are ready for whatever Archimonde might send our way, Lady Proudmoore." diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index caff71c7320..df180bf5568 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -27,6 +27,9 @@ EndScriptData */ #include "InstanceScript.h" #include "ScriptedCreature.h" #include "hyjal_trash.h" +#include "Player.h" +#include "WorldPacket.h" +#include "Opcodes.h" enum Misc { @@ -156,7 +159,7 @@ public: } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -293,7 +296,7 @@ public: } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index e74ba833908..365c5dd7300 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -21,6 +21,8 @@ #include "culling_of_stratholme.h" #include "ScriptedEscortAI.h" #include "PassiveAI.h" +#include "Player.h" +#include "SpellInfo.h" enum Says { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index ea02e8f50b5..0467109effc 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -19,6 +19,9 @@ #include "InstanceScript.h" #include "CreatureTextMgr.h" #include "culling_of_stratholme.h" +#include "Player.h" +#include "TemporarySummon.h" +#include "SpellInfo.h" #define MAX_ENCOUNTER 5 @@ -195,7 +198,7 @@ class instance_culling_of_stratholme : public InstanceMapScript SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -215,7 +218,7 @@ class instance_culling_of_stratholme : public InstanceMapScript return 0; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp index bed3cde6fa4..8ca14d72b94 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -33,6 +33,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "dark_portal.h" +#include "Player.h" +#include "SpellInfo.h" #define SAY_ENTER -1269020 //where does this belong? #define SAY_INTRO -1269021 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index da34eff7b77..b7820bae920 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -26,6 +26,9 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "dark_portal.h" +#include "Player.h" +#include "TemporarySummon.h" +#include "SpellInfo.h" #define MAX_ENCOUNTER 2 @@ -236,7 +239,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -252,7 +255,7 @@ public: return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { if (data == DATA_MEDIVH) return MedivhGUID; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index 7f7cbeaf566..5f7af55358e 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "InstanceScript.h" #include "old_hillsbrad.h" +#include "Player.h" #define MAX_ENCOUNTER 6 @@ -202,7 +203,7 @@ public: } } - uint32 GetData(uint32 data) + uint32 GetData(uint32 data) const { switch (data) { @@ -222,7 +223,7 @@ public: return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 0158d470ef9..2000d8a52f8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -34,6 +34,7 @@ EndContentData */ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "old_hillsbrad.h" +#include "Player.h" #define QUEST_ENTRY_HILLSBRAD 10282 #define QUEST_ENTRY_DIVERSION 10283 diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 0689a8872bb..adcec659fa3 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -29,6 +29,7 @@ EndScriptData */ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "onyxias_lair.h" +#include "TemporarySummon.h" class instance_onyxias_lair : public InstanceMapScript { @@ -189,7 +190,7 @@ public: } } - uint32 GetData(uint32 Type) + uint32 GetData(uint32 Type) const { switch (Type) { @@ -200,7 +201,7 @@ public: return 0; } - uint64 GetData64(uint32 Data) + uint64 GetData64(uint32 Data) const { switch (Data) { diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index a0a8bb02d90..f7161638909 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "razorfen_downs.h" +#include "Player.h" +#include "TemporarySummon.h" #define MAX_ENCOUNTER 1 @@ -185,7 +187,7 @@ public: } } - uint32 GetData(uint32 uiType) + uint32 GetData(uint32 uiType) const { switch (uiType) { @@ -196,7 +198,7 @@ public: return 0; } - uint64 GetData64(uint32 uiType) + uint64 GetData64(uint32 uiType) const { switch (uiType) { diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index 3a147007fce..443c9f73cfb 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "razorfen_downs.h" +#include "Player.h" /*### # npc_henry_stern diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index cce0f8b180e..152c38a6b58 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "razorfen_kraul.h" +#include "Player.h" #define WARD_KEEPERS_NR 2 diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index 374059c46ac..7b3cd9f9900 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "razorfen_kraul.h" +#include "Player.h" #define SAY_READY -1047000 #define SAY_POINT -1047001 diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp index 36a1ff1bade..e6c5243819a 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ruins_of_ahnqiraj.h" +#include "CreatureTextMgr.h" enum Spells { @@ -38,6 +39,11 @@ enum Events EVENT_WIDE_SLASH = 4 }; +enum Texts +{ + SAY_KURINAXX_DEATH = 5, // Yelled by Ossirian the Unscarred +}; + class boss_kurinnaxx : public CreatureScript { public: @@ -45,7 +51,7 @@ class boss_kurinnaxx : public CreatureScript struct boss_kurinnaxxAI : public BossAI { - boss_kurinnaxxAI(Creature* creature) : BossAI(creature, BOSS_KURINNAXX) + boss_kurinnaxxAI(Creature* creature) : BossAI(creature, DATA_KURINNAXX) { } @@ -68,6 +74,13 @@ class boss_kurinnaxx : public CreatureScript } } + void JustDied(Unit* /*killer*/) + { + _JustDied(); + if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetData64(DATA_OSSIRIAN))) + sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); + } + void UpdateAI(const uint32 diff) { if (!UpdateVictim()) diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index c05613d387f..4abbf99d4ef 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -58,7 +58,7 @@ class boss_moam : public CreatureScript struct boss_moamAI : public BossAI { - boss_moamAI(Creature* creature) : BossAI(creature, BOSS_MOAM) + boss_moamAI(Creature* creature) : BossAI(creature, DATA_MOAM) { } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index e9bb8be67b7..2bbdaa389ad 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2012 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 @@ -16,39 +15,262 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Ossirian -SD%Complete: 0 -SDComment: Place holder -SDCategory: Ruins of Ahn'Qiraj -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ruins_of_ahnqiraj.h" +#include "Player.h" +#include "SpellInfo.h" +#include "WorldPacket.h" +#include "Opcodes.h" + +enum Texts +{ + SAY_SUPREME = 0, + SAY_INTRO = 1, + SAY_AGGRO = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, +}; + +enum Spells +{ + SPELL_SILENCE = 25195, + SPELL_CYCLONE = 25189, + SPELL_STOMP = 25188, + SPELL_SUPREME = 25176, + SPELL_SUMMON = 20477, + SPELL_SAND_STORM = 25160, + SPELL_SUMMON_CRYSTAL = 25192, +}; + +enum Actions +{ + ACTION_TRIGGER_WEAKNESS = 1, +}; + +enum Events +{ + EVENT_SILENCE = 1, + EVENT_CYCLONE = 2, + EVENT_STOMP = 3 +}; + +uint8 const NUM_CRYSTALS = 9; -enum Yells +// You spin me right round, baby +// right round like a record, baby +// right round round round +Position CrystalCoordinates[NUM_CRYSTALS] = { - SAY_SURPREME2 = -1509019, - SAY_SURPREME3 = -1509020, - SAY_RAND_INTRO1 = -1509021, - SAY_RAND_INTRO2 = -1509022, - SAY_RAND_INTRO3 = -1509023, - SAY_RAND_INTRO4 = -1509024, //possibly old? - SAY_AGGRO = -1509025, - SAY_SLAY = -1509026, - SAY_DEATH = -1509027 + { -9394.230469f, 1951.808594f, 85.97733f, 0.0f }, + { -9357.931641f, 1930.596802f, 85.556198f, 0.0f }, + { -9383.113281f, 2011.042725f, 85.556389f, 0.0f }, + { -9243.36f, 1979.04f, 85.556f, 0.0f }, + { -9281.68f, 1886.66f, 85.5558f, 0.0f }, + { -9241.8f, 1806.39f, 85.5557f, 0.0f }, + { -9366.78f, 1781.76f, 85.5561f, 0.0f }, + { -9430.37f, 1786.86f, 85.557f, 0.0f }, + { -9406.73f, 1863.13f, 85.5558f, 0.0f } }; +float RoomRadius = 165.0f; +uint8 const NUM_TORNADOS = 5; // TODO: This number is completly random! +uint8 const NUM_WEAKNESS = 5; +uint32 const SpellWeakness[NUM_WEAKNESS] = { 25177, 25178, 25180, 25181, 25183 }; +Position const RoomCenter = { -9343.041992f, 1923.278198f, 85.555984f, 0.0 }; + class boss_ossirian : public CreatureScript { public: boss_ossirian() : CreatureScript("boss_ossirian") { } - struct boss_ossirianAI : public ScriptedAI + struct boss_ossirianAI : public BossAI { - boss_ossirianAI(Creature* creature) : ScriptedAI(creature) + boss_ossirianAI(Creature* creature) : BossAI(creature, DATA_OSSIRIAN) + { + SaidIntro = false; + Reset(); + } + + uint64 TriggerGUID; + uint64 CrystalGUID; + uint8 CrystalIterator; + bool SaidIntro; + + void Reset() + { + _Reset(); + CrystalIterator = 0; + TriggerGUID = 0; + CrystalGUID = 0; + } + + void SpellHit(Unit* caster, SpellInfo const* spell) + { + for (uint8 i = 0; i < NUM_WEAKNESS; ++i) + { + if (spell->Id == SpellWeakness[i]) + { + me->RemoveAurasDueToSpell(SPELL_SUPREME); + ((TempSummon*)caster)->UnSummon(); + SpawnNextCrystal(); + } + } + } + + void DoAction(const int32 action) + { + if (action == ACTION_TRIGGER_WEAKNESS) + { + if (Creature* Trigger = me->GetMap()->GetCreature(TriggerGUID)) + { + if (!Trigger->HasUnitState(UNIT_STATE_CASTING)) + Trigger->CastSpell(Trigger, SpellWeakness[urand(0, 4)], false); + } + } + } + + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + events.Reset(); + events.ScheduleEvent(EVENT_SILENCE, 30000); + events.ScheduleEvent(EVENT_CYCLONE, 20000); + events.ScheduleEvent(EVENT_STOMP, 30000); + + DoCast(me, SPELL_SUPREME); + Talk(SAY_AGGRO); + + if (instance) + { + Map* map = me->GetMap(); + if (!map->IsDungeon()) + return; + + WorldPacket data(SMSG_WEATHER, (4+4+4)); + data << uint32(WEATHER_STATE_HEAVY_SANDSTORM) << float(1) << uint8(0); + map->SendToPlayers(&data); + + for (uint8 i = 0; i < NUM_TORNADOS; ++i) + { + Position Point; + me->GetRandomPoint(RoomCenter, RoomRadius, Point); + if (Creature* Tornado = me->GetMap()->SummonCreature(NPC_SAND_VORTEX, Point)) + Tornado->CastSpell(Tornado, SPELL_SAND_STORM, true); + } + + SpawnNextCrystal(); + } + } + + void KilledUnit(Unit* /*victim*/) { + Talk(SAY_SLAY); + } + + void EnterEvadeMode() + { + Cleanup(); + summons.DespawnAll(); + ScriptedAI::EnterEvadeMode(); + } + + void JustDied(Unit* /*killer*/) + { + Cleanup(); + _JustDied(); + } + + void Cleanup() + { + if (GameObject* Crystal = me->GetMap()->GetGameObject(CrystalGUID)) + Crystal->Use(me); + } + + void SpawnNextCrystal() + { + if (CrystalIterator == NUM_CRYSTALS) + CrystalIterator = 0; + + if (Creature* Trigger = me->GetMap()->SummonCreature(NPC_OSSIRIAN_TRIGGER, CrystalCoordinates[CrystalIterator])) + { + TriggerGUID = Trigger->GetGUID(); + if (GameObject* Crystal = Trigger->SummonGameObject(GO_OSSIRIAN_CRYSTAL, + CrystalCoordinates[CrystalIterator].GetPositionX(), + CrystalCoordinates[CrystalIterator].GetPositionY(), + CrystalCoordinates[CrystalIterator].GetPositionZ(), + 0, 0, 0, 0, 0, -1)) + { + CrystalGUID = Crystal->GetGUID(); + ++CrystalIterator; + } + } + } + + void MoveInLineOfSight(Unit* /*who*/) + { + if (!SaidIntro) + { + Talk(SAY_INTRO); + SaidIntro = true; + } + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + // No kiting! + if (me->GetDistance(me->getVictim()) > 60.00f && me->GetDistance(me->getVictim()) < 120.00f) + DoCast(me->getVictim(), SPELL_SUMMON); + + bool ApplySupreme = true; + + if (me->HasAura(SPELL_SUPREME)) + ApplySupreme = false; + else + { + for (uint8 i = 0; i < NUM_WEAKNESS; ++i) + { + if (me->HasAura(SpellWeakness[i])) + { + ApplySupreme = false; + break; + } + } + } + + if (ApplySupreme) + { + DoCast(me, SPELL_SUPREME); + Talk(SAY_SUPREME); + } + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SILENCE: + DoCast(me, SPELL_SILENCE); + events.ScheduleEvent(EVENT_SILENCE, urand(20000, 30000)); + break; + case EVENT_CYCLONE: + DoCast(me->getVictim(), SPELL_CYCLONE); + events.ScheduleEvent(EVENT_CYCLONE, 20000); + break; + case EVENT_STOMP: + DoCast(me, SPELL_STOMP); + events.ScheduleEvent(EVENT_STOMP, 30000); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); } }; @@ -58,7 +280,28 @@ class boss_ossirian : public CreatureScript } }; +class go_ossirian_crystal : public GameObjectScript +{ + public: + go_ossirian_crystal() : GameObjectScript("go_ossirian_crystal") { } + + bool OnGossipHello(Player* player, GameObject* /*go*/) + { + InstanceScript* Instance = player->GetInstanceScript(); + if (!Instance) + return false; + + Creature* Ossirian = player->FindNearestCreature(NPC_OSSIRIAN, 30.0f); + if (!Ossirian || Instance->GetBossState(DATA_OSSIRIAN) != IN_PROGRESS) + return false; + + Ossirian->AI()->DoAction(ACTION_TRIGGER_WEAKNESS); + return true; + } +}; + void AddSC_boss_ossirian() { new boss_ossirian(); + new go_ossirian_crystal(); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp index afa8eff5823..da67f93f968 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp @@ -63,7 +63,7 @@ class boss_rajaxx : public CreatureScript struct boss_rajaxxAI : public BossAI { - boss_rajaxxAI(Creature* creature) : BossAI(creature, BOSS_RAJAXX) + boss_rajaxxAI(Creature* creature) : BossAI(creature, DATA_RAJAXX) { } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp index 2dbd52f7e42..d61d9416ac6 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp @@ -28,7 +28,7 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript { instance_ruins_of_ahnqiraj_InstanceMapScript(Map* map) : InstanceScript(map) { - SetBossNumber(MAX_ENCOUNTER); + SetBossNumber(NUM_ENCOUNTER); _kurinaxxGUID = 0; _rajaxxGUID = 0; @@ -71,21 +71,21 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript return true; } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { - case BOSS_KURINNAXX: + case DATA_KURINNAXX: return _kurinaxxGUID; - case BOSS_RAJAXX: + case DATA_RAJAXX: return _rajaxxGUID; - case BOSS_MOAM: + case DATA_MOAM: return _moamGUID; - case BOSS_BURU: + case DATA_BURU: return _buruGUID; - case BOSS_AYAMISS: + case DATA_AYAMISS: return _ayamissGUID; - case BOSS_OSSIRIAN: + case DATA_OSSIRIAN: return _ossirianGUID; } @@ -120,7 +120,7 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript if (dataHead1 == 'R' && dataHead2 == 'A') { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + for (uint8 i = 0; i < NUM_ENCOUNTER; ++i) { uint32 tmpState; loadStream >> tmpState; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h index 14d129a7468..7f7efc83eb5 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h @@ -18,15 +18,15 @@ #ifndef DEF_RUINS_OF_AHNQIRAJ_H #define DEF_RUINS_OF_AHNQIRAJ_H -enum Encounters +enum DataTypes { - BOSS_KURINNAXX = 0, - BOSS_RAJAXX = 1, - BOSS_MOAM = 2, - BOSS_BURU = 3, - BOSS_AYAMISS = 4, - BOSS_OSSIRIAN = 5, - MAX_ENCOUNTER, + DATA_KURINNAXX = 0, + DATA_RAJAXX = 1, + DATA_MOAM = 2, + DATA_BURU = 3, + DATA_AYAMISS = 4, + DATA_OSSIRIAN = 5, + NUM_ENCOUNTER = 6 }; enum Creatures @@ -40,6 +40,13 @@ enum Creatures NPC_HIVEZARA_HORNET = 15934, NPC_HIVEZARA_SWARMER = 15546, NPC_HIVEZARA_LARVA = 15555, + NPC_SAND_VORTEX = 15428, + NPC_OSSIRIAN_TRIGGER = 15590, +}; + +enum GameObjects +{ + GO_OSSIRIAN_CRYSTAL = 180619, }; #endif diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 95c6d033aab..6b569bbd3e5 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" +#include "Player.h" /* * This is a 2 phases events. Here follows an explanation of the main events and transition between phases and sub-phases. diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 36388cfbe9c..917c790f42b 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" #include "Group.h" +#include "Player.h" #define SAY_AGGRO1 -1531000 #define SAY_AGGRO2 -1531001 diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index 887ca4f3ad5..c8a1ff63925 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -90,7 +90,7 @@ public: return false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -118,7 +118,7 @@ public: return 0; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index 1bb5c1180bd..afd4d834f07 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -80,7 +80,7 @@ public: if (data == DONE)SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -98,7 +98,7 @@ public: return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { if (data == DATA_NARALEX)return NaralexGUID; return 0; diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 0d4efac4321..e1a3c3aeb45 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "wailing_caverns.h" +#include "Player.h" /*###### ## npc_disciple_of_naralex diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 3a6a3f6241c..4cdddb2d9da 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "zulfarrak.h" +#include "Player.h" +#include "TemporarySummon.h" #define NPC_GAHZRILLA 7273 #define PATH_ADDS 81553 @@ -179,7 +181,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -189,7 +191,7 @@ public: return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index 03e3756f964..f288db920f4 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -32,6 +32,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "zulfarrak.h" +#include "Player.h" /*###### ## npc_sergeant_bly diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp index 6a9dd77433a..0e44da371d6 100644 --- a/src/server/scripts/Kalimdor/ashenvale.cpp +++ b/src/server/scripts/Kalimdor/ashenvale.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*#### # npc_torek diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp index 8d08c26f0a7..c8eb5daef68 100644 --- a/src/server/scripts/Kalimdor/azshara.cpp +++ b/src/server/scripts/Kalimdor/azshara.cpp @@ -33,6 +33,9 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "SpellInfo.h" +#include "WorldSession.h" /*###### ## mobs_spitelashes diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp index 3883b740d02..339cd02c2e3 100644 --- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*###### ## mob_webbed_creature diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp index 0e02a77169e..5d10076c114 100644 --- a/src/server/scripts/Kalimdor/darkshore.cpp +++ b/src/server/scripts/Kalimdor/darkshore.cpp @@ -34,6 +34,8 @@ EndContentData */ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" +#include "Player.h" +#include "SpellInfo.h" /*#### # npc_kerlonian diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp index e196c71f681..30a87ef0197 100644 --- a/src/server/scripts/Kalimdor/desolace.cpp +++ b/src/server/scripts/Kalimdor/desolace.cpp @@ -34,6 +34,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "SpellInfo.h" enum DyingKodo { diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index ec06a542b6f..83111829c9e 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "Vehicle.h" #include "SpellScript.h" +#include "Player.h" /*###### ##Quest 5441: Lazy Peons diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 5800a6a58a0..6ab9b653c5d 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -36,6 +36,8 @@ EndContentData */ #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "SpellScript.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## mobs_risen_husk_spirit diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp index 1a0aa7b21c0..f1d9a9028e1 100644 --- a/src/server/scripts/Kalimdor/felwood.cpp +++ b/src/server/scripts/Kalimdor/felwood.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*###### ## npcs_riverbreeze_and_silversky diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp index c1e247044f7..df4345b3aae 100644 --- a/src/server/scripts/Kalimdor/feralas.cpp +++ b/src/server/scripts/Kalimdor/feralas.cpp @@ -28,6 +28,8 @@ EndScriptData */ #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "SpellScript.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## npc_gregan_brewspewer diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 3c8d2267903..6d93e074e79 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -35,6 +35,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ## npc_bunthen_plainswind diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp index 5b35688c2b8..8ed26b8cf38 100644 --- a/src/server/scripts/Kalimdor/mulgore.cpp +++ b/src/server/scripts/Kalimdor/mulgore.cpp @@ -32,6 +32,8 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "SpellInfo.h" /*###### # npc_skorn_whitecloud diff --git a/src/server/scripts/Kalimdor/orgrimmar.cpp b/src/server/scripts/Kalimdor/orgrimmar.cpp index fca8d0f5fc5..5080daefbf9 100644 --- a/src/server/scripts/Kalimdor/orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/orgrimmar.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*###### ## npc_shenthul diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index 45a2fad9999..df7d3b1ee89 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -33,6 +33,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "Group.h" +#include "Player.h" /*### ## npc_highlord_demitrian diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp index d38395c7b37..5cf6d141805 100644 --- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp @@ -32,6 +32,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_braug_dimspirit diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp index 417c8b338c7..7341ccb1e2c 100644 --- a/src/server/scripts/Kalimdor/tanaris.cpp +++ b/src/server/scripts/Kalimdor/tanaris.cpp @@ -38,6 +38,8 @@ EndContentData */ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## mob_aquementas diff --git a/src/server/scripts/Kalimdor/teldrassil.cpp b/src/server/scripts/Kalimdor/teldrassil.cpp index 7f2b2fc7f05..6c1993d6447 100644 --- a/src/server/scripts/Kalimdor/teldrassil.cpp +++ b/src/server/scripts/Kalimdor/teldrassil.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedFollowerAI.h" +#include "Player.h" /*#### # npc_mist diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index f4983558b67..8a24f696a23 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -36,6 +36,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ## npc_beaten_corpse diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp index b9ae356ddf1..7667a8b312c 100644 --- a/src/server/scripts/Kalimdor/thousand_needles.cpp +++ b/src/server/scripts/Kalimdor/thousand_needles.cpp @@ -36,6 +36,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*##### # npc_kanati diff --git a/src/server/scripts/Kalimdor/thunder_bluff.cpp b/src/server/scripts/Kalimdor/thunder_bluff.cpp index b8b05b9692f..1b10a3a204b 100644 --- a/src/server/scripts/Kalimdor/thunder_bluff.cpp +++ b/src/server/scripts/Kalimdor/thunder_bluff.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" /*##### # npc_cairne_bloodhoof diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp index 786d2fc0cd3..e00ea566c8f 100644 --- a/src/server/scripts/Kalimdor/ungoro_crater.cpp +++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp @@ -32,6 +32,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" +#include "Player.h" +#include "SpellInfo.h" enum AmeData { diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index 2c4da0fdf7c..73b8bfe9af1 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -30,6 +30,8 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## npc_rivern_frostwind diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp index fe86f54ae15..9b48d7a9e1c 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp @@ -116,7 +116,7 @@ class boss_elder_nadox : public CreatureScript GuardianDied = true; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_RESPECT_YOUR_ELDERS) return !GuardianDied ? 1 : 0; diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index 3a937942118..b4756a33b38 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -22,6 +22,8 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ahnkahet.h" +#include "Player.h" +#include "SpellInfo.h" enum Spells { diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index 02dcc04abd6..e6bb23b61d7 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -156,7 +156,7 @@ public: volunteerWork = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_VOLUNTEER_WORK) return volunteerWork ? 1 : 0; diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp index f870c61dd5f..7eaf8368c21 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp @@ -160,7 +160,7 @@ public: } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -252,7 +252,7 @@ public: SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index 4e06ac0ba3a..10575ae288c 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -105,7 +105,7 @@ public: } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -149,7 +149,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index a9d6d9d91ba..e20b08c515e 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -404,7 +404,7 @@ public: me->AddLootMode(LOOT_MODE_HARD_MODE_1); // Add 1st Drake loot mode } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == TWILIGHT_ACHIEVEMENTS) return drakeCount; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp index 7d4438ed7c7..c39d7fbeb09 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp @@ -108,7 +108,7 @@ public: m_bVesperonKilled = true; } - uint32 GetData(uint32 uiType) + uint32 GetData(uint32 uiType) const { if (uiType == TYPE_SARTHARION_EVENT) return m_auiEncounter[0]; @@ -122,7 +122,7 @@ public: return 0; } - uint64 GetData64(uint32 uiData) + uint64 GetData64(uint32 uiData) const { switch (uiData) { diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 1d0b0fd6ee6..2bb2b1c3cd7 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -24,12 +24,13 @@ #include "GameObjectAI.h" #include "ScriptedCreature.h" #include "ruby_sanctum.h" +#include "Player.h" /* ScriptData SDName: ruby_sanctum SDAuthors: Kaelima, Warpten SD%Complete: 90% -SDComment: Based on Kaelima's initial work (nearly half of it). Corporeality handling is a pure guess, we lack info. +SDComment: Based on Kaelima's initial work (half of it). Corporeality handling is a pure guess, we lack info. SDCategory: Chamber of Aspects EndScriptData */ @@ -123,13 +124,12 @@ enum Events // Halion EVENT_ACTIVATE_FIREWALL = 1, EVENT_CLEAVE = 2, - EVENT_FLAME_BREATH = 3, + EVENT_BREATH = 3, EVENT_METEOR_STRIKE = 4, EVENT_FIERY_COMBUSTION = 5, EVENT_TAIL_LASH = 6, // Twilight Halion - EVENT_DARK_BREATH = 7, EVENT_SOUL_CONSUMPTION = 8, // Meteor Strike @@ -153,12 +153,10 @@ enum Actions ACTION_METEOR_STRIKE_AOE = 2, // Halion Controller - ACTION_PHASE_TWO = 3, - ACTION_PHASE_THREE = 4, - ACTION_CLEANUP = 5, + ACTION_MONITOR_CORPOREALITY = 3, // Orb Carrier - ACTION_SHOOT = 6 + ACTION_SHOOT = 4 }; enum Phases @@ -231,9 +229,11 @@ struct generic_halionAI : public BossAI void EnterCombat(Unit* who) { BossAI::EnterCombat(who); + me->AddAura(SPELL_TWILIGHT_PRECISION, me); _canEvade = false; events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); events.ScheduleEvent(EVENT_TAIL_LASH, 10000); + events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000)); } void Reset() @@ -260,19 +260,20 @@ struct generic_halionAI : public BossAI DoCastAOE(SPELL_TAIL_LASH); events.ScheduleEvent(EVENT_TAIL_LASH, 10000); break; + case EVENT_BREATH: + DoCast(me, me->GetEntry() == NPC_HALION ? SPELL_FLAME_BREATH : SPELL_DARK_BREATH); + events.ScheduleEvent(EVENT_BREATH, urand(10000, 12000)); + break; } } void UpdateAI(uint32 const diff) { - if (!UpdateVictim()) + if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING)) return; events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - while (uint32 eventId = events.ExecuteEvent()) ExecuteEvent(eventId); @@ -319,7 +320,6 @@ class boss_halion : public CreatureScript me->SetReactState(REACT_DEFENSIVE); me->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(SPELL_TWILIGHT_PRECISION, me); } void EnterEvadeMode() @@ -342,7 +342,6 @@ class boss_halion : public CreatureScript instance->SetBossState(DATA_HALION, IN_PROGRESS); events.ScheduleEvent(EVENT_ACTIVATE_FIREWALL, 5000); - events.ScheduleEvent(EVENT_FLAME_BREATH, urand(10000, 12000)); events.ScheduleEvent(EVENT_METEOR_STRIKE, urand(20000, 25000)); events.ScheduleEvent(EVENT_FIERY_COMBUSTION, urand(15000, 18000)); @@ -408,10 +407,6 @@ class boss_halion : public CreatureScript if (GameObject* flameRing = ObjectAccessor::GetGameObject(*me, instance->GetData64(i))) instance->HandleGameObject(instance->GetData64(DATA_FLAME_RING), false, flameRing); break; - case EVENT_FLAME_BREATH: - DoCast(me, SPELL_FLAME_BREATH); - events.ScheduleEvent(EVENT_FLAME_BREATH, 25000); - break; case EVENT_METEOR_STRIKE: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_TWILIGHT_REALM)) @@ -490,7 +485,6 @@ class boss_twilight_halion : public CreatureScript generic_halionAI::EnterCombat(who); - events.ScheduleEvent(EVENT_DARK_BREATH, urand(10000, 15000)); events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000); instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2); @@ -554,7 +548,7 @@ class boss_twilight_halion : public CreatureScript { case SPELL_TWILIGHT_DIVISION: if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) - controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_THREE); + controller->AI()->DoAction(ACTION_MONITOR_CORPOREALITY); break; default: generic_halionAI::SpellHit(who, spell); @@ -566,10 +560,6 @@ class boss_twilight_halion : public CreatureScript { switch (eventId) { - case EVENT_DARK_BREATH: - DoCast(me, SPELL_DARK_BREATH); - events.ScheduleEvent(EVENT_DARK_BREATH, urand(10000, 15000)); - break; case EVENT_SOUL_CONSUMPTION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, SPELL_TWILIGHT_REALM)) DoCast(target, SPELL_SOUL_CONSUMPTION); @@ -610,6 +600,8 @@ class npc_halion_controller : public CreatureScript _summons.DespawnAll(); _events.Reset(); _materialCorporealityValue = 5; + _materialDamageTaken = 0; + _twilightDamageTaken = 0; DoCast(me, SPELL_CLEAR_DEBUFFS); } @@ -658,6 +650,34 @@ class npc_halion_controller : public CreatureScript _events.SetPhase(PHASE_INTRO); _events.ScheduleEvent(EVENT_START_INTRO, 2000); break; + case ACTION_MONITOR_CORPOREALITY: + { + for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++) + { + Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr)); + if (!halion) + continue; + + halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), false); + halion->AI()->SetData(DATA_FIGHT_PHASE, PHASE_THREE); + + if (itr == DATA_TWILIGHT_HALION) + continue; + + halion->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING); + halion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + // Summon Twilight portals + DoCast(me, SPELL_SUMMON_EXIT_PORTALS); + + _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TOGGLE, 1); + // Hardcoding doesn't really matter here. + _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, 50); + _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 50); + + _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, 7500); + } default: break; } @@ -748,36 +768,8 @@ class npc_halion_controller : public CreatureScript DoZoneInCombat(); break; case PHASE_TWO: - // Timer taken from a 4.3.4 solo video and confirmed by TankSpot's 3.3.5 guide. http://www.tankspot.com/showthread.php?67195-Halion-Encounter-Guide-Live _events.ScheduleEvent(EVENT_SHADOW_PULSARS_SHOOT, 29000); break; - case PHASE_THREE: - _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, 5000); - // Load up corporeality data. - for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++) - { - Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr)); - if (!halion) - continue; - - halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), false); - halion->AI()->SetData(DATA_FIGHT_PHASE, PHASE_THREE); - - if (itr == DATA_TWILIGHT_HALION) - continue; - - halion->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING); - halion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - // Summon Twilight portals - DoCast(me, SPELL_SUMMON_EXIT_PORTALS); - - _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TOGGLE, 1); - // Hardcoding doesn't really matter here. - _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, 50); - _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 50); - break; default: break; } @@ -808,17 +800,21 @@ class npc_halion_controller : public CreatureScript float damageRatio = float(_materialDamageTaken) / float(_twilightDamageTaken); CorporealityEvent action = CORPOREALITY_NONE; - if (damageRatio < 0.98f) // [0 , 0.98[: Corporeality goes down + if (damageRatio < 0.98f) // [0 , 0.98[: Corporeality goes down action = CORPOREALITY_DECREASE; - else if (0.99f < damageRatio && damageRatio < 1.0f) // ]0.99, 1.01[: Twilight Mending + else if (0.99f < damageRatio && damageRatio < 1.01f) // ]0.99, 1.01[: Twilight Mending action = CORPOREALITY_TWILIGHT_MENDING; - else if (1.02f < damageRatio) // ]1.02, +oo [: Corporeality goes up + else if (1.02f < damageRatio) // ]1.02, +oo [: Corporeality goes up action = CORPOREALITY_INCREASE; switch (action) { case CORPOREALITY_NONE: + { + _materialDamageTaken = 0; + _twilightDamageTaken = 0; return; + } case CORPOREALITY_INCREASE: { if (_materialCorporealityValue >= (MAX_CORPOREALITY_STATE - 1)) diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index bf48132b2b2..939c22325d7 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -18,7 +18,9 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "ruby_sanctum.h" - +#include "Player.h" +#include "TemporarySummon.h" +#include "WorldPacket.h" DoorData const doorData[] = { @@ -162,7 +164,7 @@ class instance_ruby_sanctum : public InstanceMapScript } } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { @@ -272,7 +274,7 @@ class instance_ruby_sanctum : public InstanceMapScript BaltharusSharedHealth = data; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type != DATA_BALTHARUS_SHARED_HEALTH) return 0; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp index 273c860a2ad..ce543b95fd5 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ruby_sanctum.h" +#include "Player.h" enum Texts { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index f3b6078d536..35a22c6bf37 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "ScriptedEscortAI.h" #include "Vehicle.h" #include "trial_of_the_champion.h" +#include "Player.h" enum eSpells { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index 310dd1003c3..d2a01003324 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "InstanceScript.h" #include "trial_of_the_champion.h" +#include "Player.h" #define MAX_ENCOUNTER 4 @@ -234,7 +235,7 @@ public: SaveToDB(); } - uint32 GetData(uint32 uiData) + uint32 GetData(uint32 uiData) const { switch (uiData) { @@ -250,7 +251,7 @@ public: return 0; } - uint64 GetData64(uint32 uiData) + uint64 GetData64(uint32 uiData) const { switch (uiData) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index a2488513d63..ffda3d12e2f 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptedGossip.h" #include "trial_of_the_champion.h" #include "Vehicle.h" +#include "Player.h" #define GOSSIP_START_EVENT1 "I'm ready to start challenge." #define GOSSIP_START_EVENT2 "I'm ready for the next challenge." diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 564df34462b..a77f341a49b 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -16,24 +16,16 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: boss_anubarak_trial -SD%Complete: ??% -SDComment: based on /dev/rsa -SDCategory: -EndScriptData */ - // Known bugs: // Anubarak - underground phase partially not worked // - tele after impale hit a permafrost doesn't work (the entire tele spell should be better) -// Burrow - visual is vanishing -// Burrower - Spider Frenzy not working as it should (frenzy not stacking) // Scarab - Kill credit isn't crediting? -// FrostSph - often they are casting Permafrost a little above the ground #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "trial_of_the_crusader.h" +#include "SpellScript.h" +#include <limits> enum Yells { @@ -47,7 +39,7 @@ enum Yells SAY_KILL_PLAYER = 7, SAY_DEATH = 8, - EMOTE_SPIKE = 0, + EMOTE_SPIKE = 0 }; enum Summons @@ -56,7 +48,7 @@ enum Summons NPC_BURROW = 34862, NPC_BURROWER = 34607, NPC_SCARAB = 34605, - NPC_SPIKE = 34660, + NPC_SPIKE = 34660 }; enum BossSpells @@ -86,8 +78,9 @@ enum BossSpells SPELL_EXPOSE_WEAKNESS = 67720, //Passive - Triggered SPELL_SHADOW_STRIKE = 66134, SPELL_SUBMERGE_EFFECT = 68394, - SPELL_EMERGE_EFFECT = 65982, SPELL_AWAKENED = 66311, + SPELL_EMERGE_EFFECT = 65982, + SPELL_PERSISTENT_DIRT = 68048, SUMMON_SCARAB = NPC_SCARAB, @@ -107,15 +100,15 @@ enum BossSpells SPELL_SPIKE_SPEED2 = 65922, SPELL_SPIKE_SPEED3 = 65923, SPELL_SPIKE_FAIL = 66181, - SPELL_SPIKE_TELE = 66170, + SPELL_SPIKE_TELE = 66170 }; #define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(66193, 67855, 67856, 67857) enum SummonActions { - ACTION_SHADOW_STRIKE, - ACTION_SCARAB_SUBMERGE, + ACTION_SHADOW_STRIKE = 0, + ACTION_SCARAB_SUBMERGE = 1 }; const Position SphereSpawn[6] = @@ -133,446 +126,468 @@ enum MovementPoints POINT_FALL_GROUND = 1 }; -class boss_anubarak_trial : public CreatureScript +enum PursuingSpikesPhases { -public: - boss_anubarak_trial() : CreatureScript("boss_anubarak_trial") { } + PHASE_NO_MOVEMENT = 0, + PHASE_IMPALE_NORMAL = 1, + PHASE_IMPALE_MIDDLE = 2, + PHASE_IMPALE_FAST = 3 +}; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_anubarak_trialAI(creature); - }; +enum Events +{ + // Anub'arak + EVENT_FREEZE_SLASH = 1, + EVENT_PENETRATING_COLD = 2, + EVENT_SUMMON_NERUBIAN = 3, + EVENT_NERUBIAN_SHADOW_STRIKE = 4, + EVENT_SUBMERGE = 5, + EVENT_EMERGE = 6, + EVENT_PURSUING_SPIKE = 7, + EVENT_SUMMON_SCARAB = 8, + EVENT_SUMMON_FROST_SPHERE = 9, + EVENT_BERSERK = 10 +}; - struct boss_anubarak_trialAI : public ScriptedAI - { - boss_anubarak_trialAI(Creature* creature) : ScriptedAI(creature), Summons(me) - { - instance = creature->GetInstanceScript(); - } +enum Phases +{ + // Anub'arak + PHASE_MELEE = 1, + PHASE_SUBMERGED = 2, - InstanceScript* instance; - - SummonList Summons; - std::list<uint64> m_vBurrowGUID; - uint64 m_aSphereGUID[6]; - - uint32 m_uiFreezeSlashTimer; - uint32 m_uiPenetratingColdTimer; - uint32 m_uiSummonNerubianTimer; - uint32 m_uiNerubianShadowStrikeTimer; - uint32 m_uiSubmergeTimer; - uint32 m_uiPursuingSpikeTimer; - uint32 m_uiSummonScarabTimer; - uint32 m_uiSummonFrostSphereTimer; - uint32 m_uiBerserkTimer; - - uint8 m_uiStage; - bool m_bIntro; - bool m_bReachedPhase3; - uint64 m_uiTargetGUID; - uint8 m_uiScarabSummoned; - - void Reset() - { - m_uiFreezeSlashTimer = 15*IN_MILLISECONDS; - m_uiPenetratingColdTimer = 20*IN_MILLISECONDS; - m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS; - m_uiSummonNerubianTimer = 10*IN_MILLISECONDS; - m_uiSubmergeTimer = 80*IN_MILLISECONDS; - - m_uiPursuingSpikeTimer = 2*IN_MILLISECONDS; - m_uiSummonScarabTimer = 2*IN_MILLISECONDS; - - m_uiSummonFrostSphereTimer = 20*IN_MILLISECONDS; - - m_uiBerserkTimer = 10*MINUTE*IN_MILLISECONDS; - m_uiStage = 0; - m_uiScarabSummoned = 0; - m_bIntro = true; - m_bReachedPhase3 = false; - m_uiTargetGUID = 0; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - Summons.DespawnAll(); - m_vBurrowGUID.clear(); - } + PHASE_MASK_MELEE = 1 << PHASE_MELEE +}; - void KilledUnit(Unit* who) +class boss_anubarak_trial : public CreatureScript +{ + public: + boss_anubarak_trial() : CreatureScript("boss_anubarak_trial") { } + + struct boss_anubarak_trialAI : public BossAI { - if (who->GetTypeId() == TYPEID_PLAYER) + boss_anubarak_trialAI(Creature* creature) : BossAI(creature, BOSS_ANUBARAK) { - Talk(SAY_KILL_PLAYER); - if (instance) - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } - } - void MoveInLineOfSight(Unit* /*who*/) - { - if (!m_bIntro) + void Reset() { - Talk(SAY_INTRO); - m_bIntro = false; + _Reset(); + events.SetPhase(PHASE_MELEE); + events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE); + events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, PHASE_MELEE); + events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 10*IN_MILLISECONDS, 0, PHASE_MELEE); + events.ScheduleEvent(EVENT_SUBMERGE, 80*IN_MILLISECONDS, 0, PHASE_MELEE); + events.ScheduleEvent(EVENT_BERSERK, 10*MINUTE*IN_MILLISECONDS); + if (IsHeroic()) + events.ScheduleEvent(EVENT_NERUBIAN_SHADOW_STRIKE, 30*IN_MILLISECONDS, 0, PHASE_MELEE); + + if (!IsHeroic()) + events.ScheduleEvent(EVENT_SUMMON_FROST_SPHERE, 20*IN_MILLISECONDS); + + _intro = true; + _reachedPhase3 = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + // clean up spawned Frost Spheres + std::list<Creature*> FrostSphereList; + me->GetCreatureListWithEntryInGrid(FrostSphereList, NPC_FROST_SPHERE, 150.0f); + if (!FrostSphereList.empty()) + for (std::list<Creature*>::iterator itr = FrostSphereList.begin(); itr != FrostSphereList.end(); itr++) + (*itr)->DespawnOrUnsummon(); + + _burrowGUID.clear(); } - } - void JustReachedHome() - { - if (instance) - instance->SetData(TYPE_ANUBARAK, FAIL); - //Summon Scarab Swarms neutral at random places - for (int i=0; i < 10; i++) - if (Creature* temp = me->SummonCreature(NPC_SCARAB, AnubarakLoc[1].GetPositionX()+urand(0, 50)-25, AnubarakLoc[1].GetPositionY()+urand(0, 50)-25, AnubarakLoc[1].GetPositionZ())) + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER) { - temp->setFaction(31); - temp->GetMotionMaster()->MoveRandom(10); + Talk(SAY_KILL_PLAYER); + if (instance) + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } - } - - void JustDied(Unit* /*killer*/) - { - Summons.DespawnAll(); - Talk(SAY_DEATH); - if (instance) - instance->SetData(TYPE_ANUBARAK, DONE); - } - - void JustSummoned(Creature* summoned) - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true); - switch (summoned->GetEntry()) - { - case NPC_BURROW: - m_vBurrowGUID.push_back(summoned->GetGUID()); - summoned->SetReactState(REACT_PASSIVE); - summoned->CastSpell(summoned, SPELL_CHURNING_GROUND, false); - break; - case NPC_SPIKE: - summoned->CombatStart(target); - Talk(EMOTE_SPIKE, target->GetGUID()); - break; - } - Summons.Summon(summoned); - } + } - void SummonedCreatureDespawn(Creature* summoned) - { - switch (summoned->GetEntry()) + void MoveInLineOfSight(Unit* /*who*/) { - case NPC_SPIKE: - m_uiPursuingSpikeTimer = 2*IN_MILLISECONDS; - break; + if (!_intro) + { + Talk(SAY_INTRO); + _intro = false; + } } - } - - void EnterCombat(Unit* /*who*/) - { - Talk(SAY_AGGRO); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetInCombatWithZone(); - if (instance) - instance->SetData(TYPE_ANUBARAK, IN_PROGRESS); - //Despawn Scarab Swarms neutral - EntryCheckPredicate pred(NPC_SCARAB); - Summons.DoAction(ACTION_SCARAB_SUBMERGE, pred); - //Spawn Burrow - for (int i=0; i < 4; i++) - me->SummonCreature(NPC_BURROW, AnubarakLoc[i+2]); - //Spawn Frost Spheres - for (int i=0; i < 6; i++) - if (Unit* summoned = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i])) - m_aSphereGUID[i] = summoned->GetGUID(); - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void JustReachedHome() + { + if (instance) + instance->SetBossState(BOSS_ANUBARAK, FAIL); + //Summon Scarab Swarms neutral at random places + for (int i = 0; i < 10; i++) + if (Creature* temp = me->SummonCreature(NPC_SCARAB, AnubarakLoc[1].GetPositionX()+urand(0, 50)-25, AnubarakLoc[1].GetPositionY()+urand(0, 50)-25, AnubarakLoc[1].GetPositionZ())) + { + temp->setFaction(31); + temp->GetMotionMaster()->MoveRandom(10); + } + } - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + void JustDied(Unit* /*killer*/) + { + _JustDied(); + Talk(SAY_DEATH); + + // despawn frostspheres and Burrowers on death + std::list<Creature*> AddList; + me->GetCreatureListWithEntryInGrid(AddList, NPC_FROST_SPHERE, 150.0f); + me->GetCreatureListWithEntryInGrid(AddList, NPC_BURROWER, 150.0f); + if (!AddList.empty()) + for (std::list<Creature*>::iterator itr = AddList.begin(); itr != AddList.end(); itr++) + (*itr)->DespawnOrUnsummon(); + } - switch (m_uiStage) + void JustSummoned(Creature* summoned) { - case 0: - if (m_uiFreezeSlashTimer <= uiDiff) - { - DoCastVictim(SPELL_FREEZE_SLASH); - m_uiFreezeSlashTimer = 15*IN_MILLISECONDS; - } else m_uiFreezeSlashTimer -= uiDiff; + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); + switch (summoned->GetEntry()) + { + case NPC_BURROW: + _burrowGUID.push_back(summoned->GetGUID()); + summoned->SetReactState(REACT_PASSIVE); + summoned->CastSpell(summoned, SPELL_CHURNING_GROUND, false); + summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid2); + break; + case NPC_SPIKE: + summoned->CombatStart(target); + summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid1); + Talk(EMOTE_SPIKE, target->GetGUID()); + break; + default: + break; + } + summons.Summon(summoned); + } - if (m_uiPenetratingColdTimer <= uiDiff) - { - me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5)); - m_uiPenetratingColdTimer = 20*IN_MILLISECONDS; - } else m_uiPenetratingColdTimer -= uiDiff; + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + Talk(SAY_AGGRO); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + + // Despawn Scarab Swarms neutral + EntryCheckPredicate pred(NPC_SCARAB); + summons.DoAction(ACTION_SCARAB_SUBMERGE, pred); + + // Spawn Burrow + for (int i = 0; i < 4; i++) + me->SummonCreature(NPC_BURROW, AnubarakLoc[i + 2]); + + // Spawn 6 Frost Spheres at start + for (int i = 0; i < 6; i++) + if (Unit* summoned = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i])) + _sphereGUID[i] = summoned->GetGUID(); + } - if (m_uiSummonNerubianTimer <= uiDiff && (IsHeroic() || !m_bReachedPhase3)) - { - me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4)); - m_uiSummonNerubianTimer = 45*IN_MILLISECONDS; - } else m_uiSummonNerubianTimer -= uiDiff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - if (IsHeroic() && m_uiNerubianShadowStrikeTimer <= uiDiff) - { - EntryCheckPredicate pred(NPC_BURROWER); - Summons.DoAction(ACTION_SHADOW_STRIKE, pred); - m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS; - } else m_uiNerubianShadowStrikeTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiSubmergeTimer <= uiDiff && !m_bReachedPhase3 && !me->HasAura(SPELL_BERSERK)) - { - m_uiStage = 1; - m_uiSubmergeTimer = 60*IN_MILLISECONDS; - } else m_uiSubmergeTimer -= uiDiff; - break; - case 1: - DoCast(me, SPELL_SUBMERGE_ANUBARAK); - DoCast(me, SPELL_CLEAR_ALL_DEBUFFS); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - Talk(EMOTE_BURROWER); - m_uiScarabSummoned = 0; - m_uiSummonScarabTimer = 4*IN_MILLISECONDS; - m_uiStage = 2; - break; - case 2: - if (m_uiPursuingSpikeTimer <= uiDiff) - { - DoCast(SPELL_SPIKE_CALL); - // Just to make sure it won't happen again in this phase - m_uiPursuingSpikeTimer = 90*IN_MILLISECONDS; - } else m_uiPursuingSpikeTimer -= uiDiff; + events.Update(diff); - if (m_uiSummonScarabTimer <= uiDiff) - { - /* WORKAROUND - * - The correct implementation is more likely the comment below but it needs spell knowledge - */ - std::list<uint64>::iterator i = m_vBurrowGUID.begin(); - uint32 at = urand(0, m_vBurrowGUID.size()-1); - for (uint32 k = 0; k < at; k++) - ++i; - if (Creature* pBurrow = Unit::GetCreature(*me, *i)) - pBurrow->CastSpell(pBurrow, 66340, false); - m_uiScarabSummoned++; - m_uiSummonScarabTimer = 4*IN_MILLISECONDS; - if (m_uiScarabSummoned == 4) m_uiSummonScarabTimer = RAID_MODE(4, 20)*IN_MILLISECONDS; - - /*It seems that this spell have something more that needs to be taken into account - //Need more sniff info - DoCast(SPELL_SUMMON_BEATLES); - // Just to make sure it won't happen again in this phase - m_uiSummonScarabTimer = 90*IN_MILLISECONDS;*/ - } else m_uiSummonScarabTimer -= uiDiff; - - if (m_uiSubmergeTimer <= uiDiff) - { - m_uiStage = 3; - m_uiSubmergeTimer = 80*IN_MILLISECONDS; - } else m_uiSubmergeTimer -= uiDiff; - break; - case 3: - m_uiStage = 0; - DoCast(SPELL_SPIKE_TELE); - Summons.DespawnEntry(NPC_SPIKE); - me->RemoveAurasDueToSpell(SPELL_SUBMERGE_ANUBARAK); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_EMERGE_ANUBARAK); - me->GetMotionMaster()->MoveChase(me->getVictim()); - m_uiSummonNerubianTimer = 10*IN_MILLISECONDS; - m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS; - m_uiSummonScarabTimer = 2*IN_MILLISECONDS; - break; - } - - if (!IsHeroic()) - { - if (m_uiSummonFrostSphereTimer <= uiDiff) + while (uint32 eventId = events.ExecuteEvent()) { - uint8 startAt = urand(0, 5); - uint8 i = startAt; - do + switch (eventId) { - if (Unit* pSphere = Unit::GetCreature(*me, m_aSphereGUID[i])) + case EVENT_FREEZE_SLASH: + DoCastVictim(SPELL_FREEZE_SLASH); + events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE); + return; + case EVENT_PENETRATING_COLD: + me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5)); + events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, 0, PHASE_MELEE); + return; + case EVENT_SUMMON_NERUBIAN: + if (IsHeroic() || !_reachedPhase3) + me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4)); + events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 45*IN_MILLISECONDS, 0, PHASE_MELEE); + return; + case EVENT_NERUBIAN_SHADOW_STRIKE: { - if (!pSphere->HasAura(SPELL_FROST_SPHERE)) + EntryCheckPredicate pred(NPC_BURROWER); + summons.DoAction(ACTION_SHADOW_STRIKE, pred); + events.ScheduleEvent(EVENT_NERUBIAN_SHADOW_STRIKE, 30*IN_MILLISECONDS, 0, PHASE_MELEE); + break; + } + case EVENT_SUBMERGE: + if (!_reachedPhase3 && !me->HasAura(SPELL_BERSERK)) { - if (Creature* summon = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i])) - m_aSphereGUID[i] = summon->GetGUID(); - break; + DoCast(me, SPELL_SUBMERGE_ANUBARAK); + DoCast(me, SPELL_CLEAR_ALL_DEBUFFS); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + Talk(EMOTE_BURROWER); + events.SetPhase(PHASE_SUBMERGED); + events.ScheduleEvent(EVENT_PURSUING_SPIKE, 2*IN_MILLISECONDS, 0, PHASE_SUBMERGED); + events.ScheduleEvent(EVENT_SUMMON_SCARAB, 4*IN_MILLISECONDS, 0, PHASE_SUBMERGED); + events.ScheduleEvent(EVENT_EMERGE, 1*MINUTE*IN_MILLISECONDS, 0, PHASE_SUBMERGED); } + break; + case EVENT_PURSUING_SPIKE: + DoCast(SPELL_SPIKE_CALL); + break; + case EVENT_SUMMON_SCARAB: + { + /* WORKAROUND + * - The correct implementation is more likely the comment below but it needs spell knowledge + */ + std::list<uint64>::iterator i = _burrowGUID.begin(); + uint32 at = urand(0, _burrowGUID.size()-1); + for (uint32 k = 0; k < at; k++) + ++i; + if (Creature* pBurrow = Unit::GetCreature(*me, *i)) + pBurrow->CastSpell(pBurrow, 66340, false); + + events.ScheduleEvent(EVENT_SUMMON_SCARAB, 4*IN_MILLISECONDS, 0, PHASE_SUBMERGED); + + /*It seems that this spell have something more that needs to be taken into account + //Need more sniff info + DoCast(SPELL_SUMMON_BEATLES); + // Just to make sure it won't happen again in this phase + m_uiSummonScarabTimer = 90*IN_MILLISECONDS;*/ + break; } - i = (i+1)%6; - } while (i != startAt); - m_uiSummonFrostSphereTimer = urand(20, 30)*IN_MILLISECONDS; - } else m_uiSummonFrostSphereTimer -= uiDiff; - } + case EVENT_EMERGE: + events.ScheduleEvent(EVENT_SUBMERGE, 80*IN_MILLISECONDS, 0, PHASE_MELEE); + DoCast(SPELL_SPIKE_TELE); + summons.DespawnEntry(NPC_SPIKE); + me->RemoveAurasDueToSpell(SPELL_SUBMERGE_ANUBARAK); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_EMERGE_ANUBARAK); + events.SetPhase(PHASE_MELEE); + events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE); + events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, PHASE_MELEE); + events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 10*IN_MILLISECONDS, 0, PHASE_MELEE); + events.ScheduleEvent(EVENT_SUBMERGE, 80*IN_MILLISECONDS, 0, PHASE_MELEE); + if (IsHeroic()) + events.ScheduleEvent(EVENT_NERUBIAN_SHADOW_STRIKE, 30*IN_MILLISECONDS, 0, PHASE_MELEE); + return; + case EVENT_SUMMON_FROST_SPHERE: + { + uint8 startAt = urand(0, 5); + uint8 i = startAt; + do + { + if (Unit* pSphere = Unit::GetCreature(*me, _sphereGUID[i])) + { + if (!pSphere->HasAura(SPELL_FROST_SPHERE)) + { + if (Creature* summon = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i])) + _sphereGUID[i] = summon->GetGUID(); + break; + } + } + i = (i + 1) % 6; + } + while + (i != startAt); + events.ScheduleEvent(EVENT_SUMMON_FROST_SPHERE, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + break; + } + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + break; + default: + break; + } - if (HealthBelowPct(30) && m_uiStage == 0 && !m_bReachedPhase3) - { - m_bReachedPhase3 = true; - DoCastAOE(SPELL_LEECHING_SWARM); - Talk(EMOTE_LEECHING_SWARM); - Talk(SAY_LEECHING_SWARM); - } + } - if (m_uiBerserkTimer <= uiDiff && !me->HasAura(SPELL_BERSERK)) - { - DoCast(me, SPELL_BERSERK); - } else m_uiBerserkTimer -= uiDiff; + if (HealthBelowPct(30) && events.GetPhaseMask() & PHASE_MASK_MELEE && !_reachedPhase3) + { + _reachedPhase3 = true; + DoCastAOE(SPELL_LEECHING_SWARM); + Talk(EMOTE_LEECHING_SWARM); + Talk(SAY_LEECHING_SWARM); + } - DoMeleeAttackIfReady(); - } - }; + if (events.GetPhaseMask() & PHASE_MASK_MELEE) + DoMeleeAttackIfReady(); + } + private: + std::list<uint64> _burrowGUID; + uint64 _sphereGUID[6]; + bool _intro; + bool _reachedPhase3; + uint32 _frostSphereTimer; + uint32 _berserkTimer; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_anubarak_trialAI(creature); + }; }; class mob_swarm_scarab : public CreatureScript { -public: - mob_swarm_scarab() : CreatureScript("mob_swarm_scarab") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_swarm_scarabAI(creature); - }; - - struct mob_swarm_scarabAI : public ScriptedAI - { - mob_swarm_scarabAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - - uint32 m_uiDeterminationTimer; + public: + mob_swarm_scarab() : CreatureScript("mob_swarm_scarab") { } - void Reset() + struct mob_swarm_scarabAI : public ScriptedAI { - me->SetCorpseDelay(0); - m_uiDeterminationTimer = urand(5*IN_MILLISECONDS, 60*IN_MILLISECONDS); - DoCast(me, SPELL_ACID_MANDIBLE); - me->SetInCombatWithZone(); - if (me->isInCombat()) - if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANUBARAK))) - Anubarak->AI()->JustSummoned(me); - } + mob_swarm_scarabAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + } - void DoAction(const int32 actionId) - { - switch (actionId) + void Reset() { - case ACTION_SCARAB_SUBMERGE: - DoCast(SPELL_SUBMERGE_EFFECT); - me->DespawnOrUnsummon(1000); - break; + me->SetCorpseDelay(0); + _determinationTimer = urand(5*IN_MILLISECONDS, 60*IN_MILLISECONDS); + DoCast(me, SPELL_ACID_MANDIBLE); + me->SetInCombatWithZone(); + if (me->isInCombat()) + if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK))) + Anubarak->AI()->JustSummoned(me); } - } - void JustDied(Unit* killer) - { - DoCast(killer, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25)); - } + void DoAction(const int32 actionId) + { + switch (actionId) + { + case ACTION_SCARAB_SUBMERGE: + DoCast(SPELL_SUBMERGE_EFFECT); + me->DespawnOrUnsummon(1*IN_MILLISECONDS); + break; + default: + break; + } + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void JustDied(Unit* killer) + { + DoCast(killer, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25)); + } - /* Bosskillers don't recognize */ - if (m_uiDeterminationTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_DETERMINATION); - m_uiDeterminationTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS); - } else m_uiDeterminationTimer -= uiDiff; + if (_instance && _instance->GetBossState(BOSS_ANUBARAK) != IN_PROGRESS) + me->DisappearAndDie(); - DoMeleeAttackIfReady(); - } - }; + if (!UpdateVictim()) + return; -}; + /* Bosskillers don't recognize */ + if (_determinationTimer <= diff) + { + DoCast(me, SPELL_DETERMINATION); + _determinationTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS); + } + else + _determinationTimer -= diff; -class mob_nerubian_burrower : public CreatureScript -{ -public: - mob_nerubian_burrower() : CreatureScript("mob_nerubian_burrower") { } + DoMeleeAttackIfReady(); + } - CreatureAI* GetAI(Creature* creature) const - { - return new mob_nerubian_burrowerAI(creature); - }; + private: + InstanceScript* _instance; + uint32 _determinationTimer; + }; - struct mob_nerubian_burrowerAI : public ScriptedAI - { - mob_nerubian_burrowerAI(Creature* creature) : ScriptedAI(creature) + CreatureAI* GetAI(Creature* creature) const { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - - uint32 m_uiSpiderFrenzyTimer; - uint32 m_uiSubmergeTimer; + return new mob_swarm_scarabAI(creature); + }; +}; - void Reset() - { - me->SetCorpseDelay(10); - m_uiSpiderFrenzyTimer = urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS); - m_uiSubmergeTimer = 30*IN_MILLISECONDS; - DoCast(me, SPELL_EXPOSE_WEAKNESS); - DoCast(me, SPELL_SPIDER_FRENZY); - DoCast(me, SPELL_AWAKENED); - me->SetInCombatWithZone(); - if (me->isInCombat()) - if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANUBARAK))) - Anubarak->AI()->JustSummoned(me); - } +class mob_nerubian_burrower : public CreatureScript +{ + public: + mob_nerubian_burrower() : CreatureScript("mob_nerubian_burrower") { } - void DoAction(const int32 actionId) + struct mob_nerubian_burrowerAI : public ScriptedAI { - switch (actionId) + mob_nerubian_burrowerAI(Creature* creature) : ScriptedAI(creature) { - case ACTION_SHADOW_STRIKE: - if (!me->HasAura(SPELL_AWAKENED)) - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SHADOW_STRIKE); - break; + _instance = creature->GetInstanceScript(); } - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + void Reset() + { + me->SetCorpseDelay(10); + _submergeTimer = 30*IN_MILLISECONDS; + DoCast(me, SPELL_EXPOSE_WEAKNESS); + DoCast(me, SPELL_SPIDER_FRENZY); + DoCast(me, SPELL_AWAKENED); + me->SetInCombatWithZone(); + if (me->isInCombat()) + if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK))) + Anubarak->AI()->JustSummoned(me); + } - if ((m_uiSubmergeTimer <= uiDiff) && HealthBelowPct(80)) + void DoAction(const int32 actionId) { - if (me->HasAura(SPELL_SUBMERGE_EFFECT)) + switch (actionId) { - me->RemoveAurasDueToSpell(SPELL_SUBMERGE_EFFECT); - DoCast(me, SPELL_EMERGE_EFFECT); - DoCast(me, SPELL_AWAKENED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + case ACTION_SHADOW_STRIKE: + if (!me->HasAura(SPELL_AWAKENED)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_SHADOW_STRIKE); + break; + default: + break; } - else + } + + void UpdateAI(const uint32 diff) + { + if (_instance && _instance->GetBossState(BOSS_ANUBARAK) != IN_PROGRESS) + me->DisappearAndDie(); + + if (!UpdateVictim() && !me->HasAura(SPELL_SUBMERGE_EFFECT)) + return; + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + if ((_submergeTimer <= diff) && HealthBelowPct(80)) { - if (!me->HasAura(SPELL_PERMAFROST_HELPER)) + if (me->HasAura(SPELL_SUBMERGE_EFFECT)) { - DoCast(me, SPELL_SUBMERGE_EFFECT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_PERSISTENT_DIRT, true); + me->RemoveAurasDueToSpell(SPELL_SUBMERGE_EFFECT); + DoCast(me, SPELL_EMERGE_EFFECT); + DoCast(me, SPELL_AWAKENED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + else + { + if (!me->HasAura(SPELL_PERMAFROST_HELPER)) + { + DoCast(me, SPELL_SUBMERGE_EFFECT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_PERSISTENT_DIRT, true); + } } + _submergeTimer = 20*IN_MILLISECONDS; } - m_uiSubmergeTimer = 20*IN_MILLISECONDS; - } else m_uiSubmergeTimer -= uiDiff; + else + _submergeTimer -= diff; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + + private: + uint32 _submergeTimer; + Phases _phase; + EventMap _events; + InstanceScript* _instance; + }; + CreatureAI* GetAI(Creature* creature) const + { + return new mob_nerubian_burrowerAI(creature); + }; }; class mob_frost_sphere : public CreatureScript @@ -636,6 +651,8 @@ class mob_frost_sphere : public CreatureScript DoCast(SPELL_PERMAFROST); me->SetObjectScale(2.0f); break; + default: + break; } } }; @@ -648,92 +665,180 @@ class mob_frost_sphere : public CreatureScript class mob_anubarak_spike : public CreatureScript { -public: - mob_anubarak_spike() : CreatureScript("mob_anubarak_spike") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_anubarak_spikeAI(creature); - }; + public: + mob_anubarak_spike() : CreatureScript("mob_anubarak_spike") { } - struct mob_anubarak_spikeAI : public ScriptedAI - { - mob_anubarak_spikeAI(Creature* creature) : ScriptedAI(creature) + struct mob_anubarak_spikeAI : public ScriptedAI { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - uint32 m_uiIncreaseSpeedTimer; - uint8 m_uiSpeed; - uint64 m_uiTargetGUID; + mob_anubarak_spikeAI(Creature* creature) : ScriptedAI(creature) + { + } - void Reset() - { - // For an unknown reason this npc isn't recognize the Aura of Permafrost with this flags =/ - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); - m_uiTargetGUID = 0; - } + void Reset() + { + _phase = PHASE_NO_MOVEMENT; + _phaseSwitchTimer = 1; + // make sure the spike has everyone on threat list + me->SetInCombatWithZone(); + } - bool CanAIAttack(Unit const* victim) const - { - return victim->GetTypeId() == TYPEID_PLAYER; - } + bool CanAIAttack(Unit const* victim) const + { + return victim->GetTypeId() == TYPEID_PLAYER; + } - void EnterCombat(Unit* who) - { - m_uiTargetGUID = who->GetGUID(); - DoCast(who, SPELL_MARK); - Talk(EMOTE_SPIKE, who->GetGUID()); - me->SetSpeed(MOVE_RUN, 0.5f); - m_uiSpeed = 0; - m_uiIncreaseSpeedTimer = 1*IN_MILLISECONDS; - me->TauntApply(who); - } + void EnterCombat(Unit* who) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + StartChase(target); + Talk(EMOTE_SPIKE, who->GetGUID()); + } + } - void DamageTaken(Unit* /*who*/, uint32& uiDamage) - { - uiDamage = 0; - } + void DamageTaken(Unit* /*who*/, uint32& uiDamage) + { + uiDamage = 0; + } - void UpdateAI(const uint32 uiDiff) - { - Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID); - if (!target || !target->isAlive() || !target->HasAura(SPELL_MARK)) + void UpdateAI(const uint32 diff) { - if (Creature* pAnubarak = Unit::GetCreature((*me), instance->GetData64(NPC_ANUBARAK))) - pAnubarak->CastSpell(pAnubarak, SPELL_SPIKE_TELE, false); - me->DisappearAndDie(); - return; + if (!UpdateVictim()) + { + me->DisappearAndDie(); + return; + } + + if (_phaseSwitchTimer) + { + if (_phaseSwitchTimer <= diff) + { + switch (_phase) + { + case PHASE_NO_MOVEMENT: + DoCast(me, SPELL_SPIKE_SPEED1); + DoCast(me, SPELL_SPIKE_TRAIL); + _phase = PHASE_IMPALE_NORMAL; + if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + StartChase(target2); + Talk(EMOTE_SPIKE, target2->GetGUID()); + } + _phaseSwitchTimer = 7*IN_MILLISECONDS; + return; + case PHASE_IMPALE_NORMAL: + DoCast(me, SPELL_SPIKE_SPEED2); + _phase = PHASE_IMPALE_MIDDLE; + _phaseSwitchTimer = 7*IN_MILLISECONDS; + return; + case PHASE_IMPALE_MIDDLE: + DoCast(me, SPELL_SPIKE_SPEED3); + _phase = PHASE_IMPALE_FAST; + _phaseSwitchTimer = 0; + return; + default: + return; + } + } + else + _phaseSwitchTimer -= diff; + } } - if (m_uiIncreaseSpeedTimer) + void MoveInLineOfSight(Unit* pWho) { - if (m_uiIncreaseSpeedTimer <= uiDiff) + if (!pWho) + return; + + if (pWho->GetEntry() != NPC_FROST_SPHERE) + return; + + if (_phase == PHASE_NO_MOVEMENT) + return; + + if (me->IsWithinDist(pWho, 7.0f)) { - switch (m_uiSpeed) + switch (_phase) { - case 0: - DoCast(me, SPELL_SPIKE_SPEED1); - DoCast(me, SPELL_SPIKE_TRAIL); - m_uiSpeed = 1; - m_uiIncreaseSpeedTimer = 7*IN_MILLISECONDS; + case PHASE_IMPALE_NORMAL: + me->RemoveAurasDueToSpell(SPELL_SPIKE_SPEED1); + break; + case PHASE_IMPALE_MIDDLE: + me->RemoveAurasDueToSpell(SPELL_SPIKE_SPEED2); break; - case 1: - DoCast(me, SPELL_SPIKE_SPEED2); - m_uiSpeed = 2; - m_uiIncreaseSpeedTimer = 7*IN_MILLISECONDS; + case PHASE_IMPALE_FAST: + me->RemoveAurasDueToSpell(SPELL_SPIKE_SPEED3); break; - case 2: - DoCast(me, SPELL_SPIKE_SPEED3); - m_uiIncreaseSpeedTimer = 0; + default: break; } - } else m_uiIncreaseSpeedTimer -= uiDiff; + + me->CastSpell(me, SPELL_SPIKE_FAIL, true); + + pWho->ToCreature()->DespawnOrUnsummon(3*IN_MILLISECONDS); + + // After the spikes hit the icy surface they can't move for about ~5 seconds + _phase = PHASE_NO_MOVEMENT; + _phaseSwitchTimer = 5*IN_MILLISECONDS; + SetCombatMovement(false); + me->GetMotionMaster()->MoveIdle(); + me->GetMotionMaster()->Clear(); + } + } + + void StartChase(Unit* who) + { + DoCast(who, SPELL_MARK); + me->SetSpeed(MOVE_RUN, 0.5f); + // make sure the Spine will really follow the one he should + me->getThreatManager().clearReferences(); + me->SetInCombatWithZone(); + me->getThreatManager().addThreat(who, std::numeric_limits<float>::max()); + me->GetMotionMaster()->Clear(true); + me->GetMotionMaster()->MoveChase(who); + me->TauntApply(who); + } + + private: + uint32 _phaseSwitchTimer; + PursuingSpikesPhases _phase; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_anubarak_spikeAI(creature); + }; +}; + +class spell_impale : public SpellScriptLoader +{ + public: + spell_impale() : SpellScriptLoader("spell_impale") { } + + class spell_impale_SpellScript : public SpellScript + { + PrepareSpellScript(spell_impale_SpellScript); + + void HandleDamageCalc(SpellEffIndex /*effIndex*/) + { + Unit* target = GetHitUnit(); + uint32 permafrost = sSpellMgr->GetSpellIdForDifficulty(SPELL_PERMAFROST, target); + + // make sure Impale doesnt do damage if we are standing on permafrost + if (target && target->HasAura(permafrost)) + SetHitDamage(0); } - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_impale_SpellScript::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_impale_SpellScript(); + } }; void AddSC_boss_anubarak_trial() @@ -743,4 +848,6 @@ void AddSC_boss_anubarak_trial() new mob_nerubian_burrower(); new mob_anubarak_spike(); new mob_frost_sphere(); + + new spell_impale(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index c662daf3671..70fd93df824 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -16,26 +16,17 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: faction_champions -SD%Complete: ??% -SDComment: Scripts by Selector, modified by /dev/rsa -SDCategory: Crusader Coliseum -EndScriptData */ - -// Known bugs: -// All - untested -// Pets aren't being summoned by their masters - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" #include "SpellAuraEffects.h" #include "trial_of_the_crusader.h" +#include "Player.h" +#include "GridNotifiers.h" enum Yells { - SAY_KILL_PLAYER = 6, + SAY_KILL_PLAYER = 6 }; enum eAIs @@ -43,234 +34,527 @@ enum eAIs AI_MELEE = 0, AI_RANGED = 1, AI_HEALER = 2, - AI_PET = 3, + AI_PET = 3 }; enum eSpells { - SPELL_ANTI_AOE = 68595, - SPELL_PVP_TRINKET = 65547, + // generic + SPELL_ANTI_AOE = 68595, + SPELL_PVP_TRINKET = 65547, + + // druid healer + SPELL_LIFEBLOOM = 66093, + SPELL_NOURISH = 66066, + SPELL_REGROWTH = 66067, + SPELL_REJUVENATION = 66065, + SPELL_TRANQUILITY = 66086, + SPELL_BARKSKIN = 65860, + SPELL_THORNS = 66068, + SPELL_NATURE_GRASP = 66071, + + // shaman healer + SPELL_HEALING_WAVE = 66055, + SPELL_RIPTIDE = 66053, + SPELL_SPIRIT_CLEANSE = 66056, //friendly only + SPELL_HEROISM = 65983, + SPELL_BLOODLUST = 65980, + SPELL_HEX = 66054, + SPELL_EARTH_SHIELD = 66063, + SPELL_EARTH_SHOCK = 65973, + AURA_EXHAUSTION = 57723, + AURA_SATED = 57724, + + // paladin healer + SPELL_HAND_OF_FREEDOM = 68757, + SPELL_DIVINE_SHIELD = 66010, + SPELL_CLEANSE = 66116, + SPELL_FLASH_OF_LIGHT = 66113, + SPELL_HOLY_LIGHT = 66112, + SPELL_HOLY_SHOCK = 66114, + SPELL_HAND_OF_PROTECTION = 66009, + SPELL_HAMMER_OF_JUSTICE = 66613, + SPELL_FORBEARANCE = 25771, + + // priest healer + SPELL_RENEW = 66177, + SPELL_SHIELD = 66099, + SPELL_FLASH_HEAL = 66104, + SPELL_DISPEL = 65546, + SPELL_PSYCHIC_SCREAM = 65543, + SPELL_MANA_BURN = 66100, + SPELL_PENANCE = 66097, + + // priest dps + SPELL_SILENCE = 65542, + SPELL_VAMPIRIC_TOUCH = 65490, + SPELL_SW_PAIN = 65541, + SPELL_MIND_FLAY = 65488, + SPELL_MIND_BLAST = 65492, + SPELL_HORROR = 65545, + SPELL_DISPERSION = 65544, + SPELL_SHADOWFORM = 16592, + + // warlock + SPELL_HELLFIRE = 65816, + SPELL_CORRUPTION = 65810, + SPELL_CURSE_OF_AGONY = 65814, + SPELL_CURSE_OF_EXHAUSTION = 65815, + SPELL_FEAR = 65809, + SPELL_SEARING_PAIN = 65819, + SPELL_SHADOW_BOLT = 65821, + SPELL_UNSTABLE_AFFLICTION = 65812, + SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813, + SPELL_SUMMON_FELHUNTER = 67514, + + // mage + SPELL_ARCANE_BARRAGE = 65799, + SPELL_ARCANE_BLAST = 65791, + SPELL_ARCANE_EXPLOSION = 65800, + SPELL_BLINK = 65793, + SPELL_COUNTERSPELL = 65790, + SPELL_FROST_NOVA = 65792, + SPELL_FROSTBOLT = 65807, + SPELL_ICE_BLOCK = 65802, + SPELL_POLYMORPH = 65801, + + // hunter + SPELL_AIMED_SHOT = 65883, + SPELL_DETERRENCE = 65871, + SPELL_DISENGAGE = 65869, + SPELL_EXPLOSIVE_SHOT = 65866, + SPELL_FROST_TRAP = 65880, + SPELL_SHOOT = 65868, + SPELL_STEADY_SHOT = 65867, + SPELL_WING_CLIP = 66207, + SPELL_WYVERN_STING = 65877, + SPELL_CALL_PET = 67777, + + // druid dps + SPELL_CYCLONE = 65859, + SPELL_ENTANGLING_ROOTS = 65857, + SPELL_FAERIE_FIRE = 65863, + SPELL_FORCE_OF_NATURE = 65861, + SPELL_INSECT_SWARM = 65855, + SPELL_MOONFIRE = 65856, + SPELL_STARFIRE = 65854, + SPELL_WRATH = 65862, + + // warrior + SPELL_BLADESTORM = 65947, + SPELL_INTIMIDATING_SHOUT = 65930, + SPELL_MORTAL_STRIKE = 65926, + SPELL_CHARGE = 68764, + SPELL_DISARM = 65935, + SPELL_OVERPOWER = 65924, + SPELL_SUNDER_ARMOR = 65936, + SPELL_SHATTERING_THROW = 65940, + SPELL_RETALIATION = 65932, + + // death knight + SPELL_CHAINS_OF_ICE = 66020, + SPELL_DEATH_COIL = 66019, + SPELL_DEATH_GRIP = 66017, + SPELL_FROST_STRIKE = 66047, + SPELL_ICEBOUND_FORTITUDE = 66023, + SPELL_ICY_TOUCH = 66021, + SPELL_STRANGULATE = 66018, + SPELL_DEATH_GRIP_PULL = 64431, // used at spellscript + + // rogue + SPELL_FAN_OF_KNIVES = 65955, + SPELL_BLIND = 65960, + SPELL_CLOAK = 65961, + SPELL_BLADE_FLURRY = 65956, + SPELL_SHADOWSTEP = 66178, + SPELL_HEMORRHAGE = 65954, + SPELL_EVISCERATE = 65957, + SPELL_WOUND_POISON = 65962, + + // shaman dps (some spells taken from shaman healer) + SPELL_LAVA_LASH = 65974, + SPELL_STORMSTRIKE = 65970, + SPELL_WINDFURY = 65976, + + // paladin dps + SPELL_AVENGING_WRATH = 66011, + SPELL_CRUSADER_STRIKE = 66003, + SPELL_DIVINE_STORM = 66006, + SPELL_HAMMER_OF_JUSTICE_RET = 66007, + SPELL_JUDGEMENT_OF_COMMAND = 66005, + SPELL_REPENTANCE = 66008, + SPELL_SEAL_OF_COMMAND = 66004, + + // warlock pet + SPELL_DEVOUR_MAGIC = 67518, + SPELL_SPELL_LOCK = 67519, + + // hunter pet + SPELL_CLAW = 67793 }; -class boss_toc_champion_controller : public CreatureScript +enum Events { -public: - boss_toc_champion_controller() : CreatureScript("boss_toc_champion_controller") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new boss_toc_champion_controllerAI (creature); - } - - struct boss_toc_champion_controllerAI : public ScriptedAI - { - boss_toc_champion_controllerAI(Creature* creature) : ScriptedAI(creature), Summons(me) - { - instance = creature->GetInstanceScript(); - } + // generic + EVENT_THREAT = 1, + EVENT_REMOVE_CC = 2, + + // druid healer + EVENT_LIFEBLOOM = 1, + EVENT_NOURISH = 2, + EVENT_REGROWTH = 3, + EVENT_REJUVENATION = 4, + EVENT_TRANQUILITY = 5, + EVENT_HEAL_BARKSKIN = 6, + EVENT_THORNS = 7, + EVENT_NATURE_GRASP = 8, + + // shaman healer + EVENT_HEALING_WAVE = 1, + EVENT_RIPTIDE = 2, + EVENT_SPIRIT_CLEANSE = 3, + EVENT_HEAL_BLOODLUST_HEROISM = 4, + EVENT_HEX = 5, + EVENT_EARTH_SHIELD = 6, + EVENT_HEAL_EARTH_SHOCK = 7, + + // paladin healer + EVENT_HAND_OF_FREEDOM = 1, + EVENT_HEAL_DIVINE_SHIELD = 2, + EVENT_CLEANSE = 3, + EVENT_FLASH_OF_LIGHT = 4, + EVENT_HOLY_LIGHT = 5, + EVENT_HOLY_SHOCK = 6, + EVENT_HEAL_HAND_OF_PROTECTION = 7, + EVENT_HAMMER_OF_JUSTICE = 8, + + // priest healer + EVENT_RENEW = 1, + EVENT_SHIELD = 2, + EVENT_FLASH_HEAL = 3, + EVENT_HEAL_DISPEL = 4, + EVENT_HEAL_PSYCHIC_SCREAM = 5, + EVENT_MANA_BURN = 6, + EVENT_PENANCE = 7, + + // priest dps + EVENT_SILENCE = 1, + EVENT_VAMPIRIC_TOUCH = 2, + EVENT_SW_PAIN = 3, + EVENT_MIND_BLAST = 4, + EVENT_HORROR = 5, + EVENT_DISPERSION = 6, + EVENT_DPS_DISPEL = 7, + EVENT_DPS_PSYCHIC_SCREAM = 8, + + // warlock + EVENT_HELLFIRE = 1, + EVENT_CORRUPTION = 2, + EVENT_CURSE_OF_AGONY = 3, + EVENT_CURSE_OF_EXHAUSTION = 4, + EVENT_FEAR = 5, + EVENT_SEARING_PAIN = 6, + EVENT_UNSTABLE_AFFLICTION = 7, + + // mage + EVENT_ARCANE_BARRAGE = 1, + EVENT_ARCANE_BLAST = 2, + EVENT_ARCANE_EXPLOSION = 3, + EVENT_BLINK = 4, + EVENT_COUNTERSPELL = 5, + EVENT_FROST_NOVA = 6, + EVENT_ICE_BLOCK = 7, + EVENT_POLYMORPH = 8, + + // hunter + EVENT_AIMED_SHOT = 1, + EVENT_DETERRENCE = 2, + EVENT_DISENGAGE = 3, + EVENT_EXPLOSIVE_SHOT = 4, + EVENT_FROST_TRAP = 5, + EVENT_STEADY_SHOT = 6, + EVENT_WING_CLIP = 7, + EVENT_WYVERN_STING = 8, + + // druid dps + EVENT_CYCLONE = 1, + EVENT_ENTANGLING_ROOTS = 2, + EVENT_FAERIE_FIRE = 3, + EVENT_FORCE_OF_NATURE = 4, + EVENT_INSECT_SWARM = 5, + EVENT_MOONFIRE = 6, + EVENT_STARFIRE = 7, + EVENT_DPS_BARKSKIN = 8, + + // warrior + EVENT_BLADESTORM = 1, + EVENT_INTIMIDATING_SHOUT = 2, + EVENT_MORTAL_STRIKE = 3, + EVENT_WARR_CHARGE = 4, + EVENT_DISARM = 5, + EVENT_OVERPOWER = 6, + EVENT_SUNDER_ARMOR = 7, + EVENT_SHATTERING_THROW = 8, + EVENT_RETALIATION = 9, + + // death knight + EVENT_CHAINS_OF_ICE = 1, + EVENT_DEATH_COIL = 2, + EVENT_DEATH_GRIP = 3, + EVENT_FROST_STRIKE = 4, + EVENT_ICEBOUND_FORTITUDE = 5, + EVENT_ICY_TOUCH = 6, + EVENT_STRANGULATE = 7, + + // rogue + EVENT_FAN_OF_KNIVES = 1, + EVENT_BLIND = 2, + EVENT_CLOAK = 3, + EVENT_BLADE_FLURRY = 4, + EVENT_SHADOWSTEP = 5, + EVENT_HEMORRHAGE = 6, + EVENT_EVISCERATE = 7, + EVENT_WOUND_POISON = 8, + + // shaman dps + EVENT_DPS_EARTH_SHOCK = 1, + EVENT_LAVA_LASH = 2, + EVENT_STORMSTRIKE = 3, + EVENT_DPS_BLOODLUST_HEROISM = 4, + EVENT_DEPLOY_TOTEM = 5, + EVENT_WINDFURY = 6, + + // paladin dps + EVENT_AVENGING_WRATH = 1, + EVENT_CRUSADER_STRIKE = 2, + EVENT_DIVINE_STORM = 3, + EVENT_HAMMER_OF_JUSTICE_RET = 4, + EVENT_JUDGEMENT_OF_COMMAND = 5, + EVENT_REPENTANCE = 6, + EVENT_DPS_HAND_OF_PROTECTION = 7, + EVENT_DPS_DIVINE_SHIELD = 8, + + // warlock pet + EVENT_DEVOUR_MAGIC = 1, + EVENT_SPELL_LOCK = 2 +}; - InstanceScript* instance; - SummonList Summons; - uint32 m_uiChampionsNotStarted; - uint32 m_uiChampionsFailed; - uint32 m_uiChampionsKilled; - bool m_bInProgress; +class boss_toc_champion_controller : public CreatureScript +{ + public: + boss_toc_champion_controller() : CreatureScript("boss_toc_champion_controller") { } - void Reset() + struct boss_toc_champion_controllerAI : public ScriptedAI { - m_uiChampionsNotStarted = 0; - m_uiChampionsFailed = 0; - m_uiChampionsKilled = 0; - m_bInProgress = false; - } + boss_toc_champion_controllerAI(Creature* creature) : ScriptedAI(creature), _summons(me) + { + _instance = creature->GetInstanceScript(); + } - std::vector<uint32> SelectChampions(Team playerTeam) - { - std::vector<uint32> vHealersEntries; - vHealersEntries.clear(); - vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_DRUID_RESTORATION : NPC_ALLIANCE_DRUID_RESTORATION); - vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_PALADIN_HOLY : NPC_ALLIANCE_PALADIN_HOLY); - vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_PRIEST_DISCIPLINE : NPC_ALLIANCE_PRIEST_DISCIPLINE); - vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_SHAMAN_RESTORATION : NPC_ALLIANCE_SHAMAN_RESTORATION); - - std::vector<uint32> vOtherEntries; - vOtherEntries.clear(); - vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_DEATH_KNIGHT : NPC_ALLIANCE_DEATH_KNIGHT); - vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_HUNTER : NPC_ALLIANCE_HUNTER); - vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_MAGE : NPC_ALLIANCE_MAGE); - vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_ROGUE : NPC_ALLIANCE_ROGUE); - vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARLOCK : NPC_ALLIANCE_WARLOCK); - vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR); - - uint8 healersSubtracted = 2; - if (instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC) - healersSubtracted = 1; - for (uint8 i = 0; i < healersSubtracted; ++i) + void Reset() { - uint8 pos = urand(0, vHealersEntries.size()-1); - switch (vHealersEntries[pos]) + _championsNotStarted = 0; + _championsFailed = 0; + _championsKilled = 0; + _inProgress = false; + } + + std::vector<uint32> SelectChampions(Team playerTeam) + { + std::vector<uint32> vHealersEntries; + vHealersEntries.clear(); + vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_DRUID_RESTORATION : NPC_ALLIANCE_DRUID_RESTORATION); + vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_PALADIN_HOLY : NPC_ALLIANCE_PALADIN_HOLY); + vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_PRIEST_DISCIPLINE : NPC_ALLIANCE_PRIEST_DISCIPLINE); + vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_SHAMAN_RESTORATION : NPC_ALLIANCE_SHAMAN_RESTORATION); + + std::vector<uint32> vOtherEntries; + vOtherEntries.clear(); + vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_DEATH_KNIGHT : NPC_ALLIANCE_DEATH_KNIGHT); + vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_HUNTER : NPC_ALLIANCE_HUNTER); + vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_MAGE : NPC_ALLIANCE_MAGE); + vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_ROGUE : NPC_ALLIANCE_ROGUE); + vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARLOCK : NPC_ALLIANCE_WARLOCK); + vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR); + + uint8 healersSubtracted = 2; + if (_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || _instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC) + healersSubtracted = 1; + for (uint8 i = 0; i < healersSubtracted; ++i) { - case NPC_ALLIANCE_DRUID_RESTORATION: - vOtherEntries.push_back(NPC_ALLIANCE_DRUID_BALANCE); - break; - case NPC_HORDE_DRUID_RESTORATION: - vOtherEntries.push_back(NPC_HORDE_DRUID_BALANCE); - break; - case NPC_ALLIANCE_PALADIN_HOLY: - vOtherEntries.push_back(NPC_ALLIANCE_PALADIN_RETRIBUTION); - break; - case NPC_HORDE_PALADIN_HOLY: - vOtherEntries.push_back(NPC_HORDE_PALADIN_RETRIBUTION); - break; - case NPC_ALLIANCE_PRIEST_DISCIPLINE: - vOtherEntries.push_back(NPC_ALLIANCE_PRIEST_SHADOW); - break; - case NPC_HORDE_PRIEST_DISCIPLINE: - vOtherEntries.push_back(NPC_HORDE_PRIEST_SHADOW); - break; - case NPC_ALLIANCE_SHAMAN_RESTORATION: - vOtherEntries.push_back(NPC_ALLIANCE_SHAMAN_ENHANCEMENT); - break; - case NPC_HORDE_SHAMAN_RESTORATION: - vOtherEntries.push_back(NPC_HORDE_SHAMAN_ENHANCEMENT); - break; + uint8 pos = urand(0, vHealersEntries.size() - 1); + switch (vHealersEntries[pos]) + { + case NPC_ALLIANCE_DRUID_RESTORATION: + vOtherEntries.push_back(NPC_ALLIANCE_DRUID_BALANCE); + break; + case NPC_HORDE_DRUID_RESTORATION: + vOtherEntries.push_back(NPC_HORDE_DRUID_BALANCE); + break; + case NPC_ALLIANCE_PALADIN_HOLY: + vOtherEntries.push_back(NPC_ALLIANCE_PALADIN_RETRIBUTION); + break; + case NPC_HORDE_PALADIN_HOLY: + vOtherEntries.push_back(NPC_HORDE_PALADIN_RETRIBUTION); + break; + case NPC_ALLIANCE_PRIEST_DISCIPLINE: + vOtherEntries.push_back(NPC_ALLIANCE_PRIEST_SHADOW); + break; + case NPC_HORDE_PRIEST_DISCIPLINE: + vOtherEntries.push_back(NPC_HORDE_PRIEST_SHADOW); + break; + case NPC_ALLIANCE_SHAMAN_RESTORATION: + vOtherEntries.push_back(NPC_ALLIANCE_SHAMAN_ENHANCEMENT); + break; + case NPC_HORDE_SHAMAN_RESTORATION: + vOtherEntries.push_back(NPC_HORDE_SHAMAN_ENHANCEMENT); + break; + default: + break; + } + vHealersEntries.erase(vHealersEntries.begin() + pos); } - vHealersEntries.erase(vHealersEntries.begin()+pos); - } - if (instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC) - for (uint8 i = 0; i < 4; ++i) - vOtherEntries.erase(vOtherEntries.begin()+urand(0, vOtherEntries.size()-1)); + if (_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || _instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC) + for (uint8 i = 0; i < 4; ++i) + vOtherEntries.erase(vOtherEntries.begin() + urand(0, vOtherEntries.size() - 1)); - std::vector<uint32> vChampionEntries; - vChampionEntries.clear(); - for (uint8 i = 0; i < vHealersEntries.size(); ++i) - vChampionEntries.push_back(vHealersEntries[i]); - for (uint8 i = 0; i < vOtherEntries.size(); ++i) - vChampionEntries.push_back(vOtherEntries[i]); + std::vector<uint32> vChampionEntries; + vChampionEntries.clear(); + for (uint8 i = 0; i < vHealersEntries.size(); ++i) + vChampionEntries.push_back(vHealersEntries[i]); + for (uint8 i = 0; i < vOtherEntries.size(); ++i) + vChampionEntries.push_back(vOtherEntries[i]); - return vChampionEntries; - } + return vChampionEntries; + } - void SummonChampions(Team playerTeam) - { - std::vector<Position> vChampionJumpOrigin; - if (playerTeam == ALLIANCE) - for (uint8 i = 0; i < 5; i++) - vChampionJumpOrigin.push_back(FactionChampionLoc[i]); - else - for (uint8 i = 5; i < 10; i++) - vChampionJumpOrigin.push_back(FactionChampionLoc[i]); + void SummonChampions(Team playerTeam) + { + std::vector<Position> vChampionJumpOrigin; + if (playerTeam == ALLIANCE) + for (uint8 i = 0; i < 5; i++) + vChampionJumpOrigin.push_back(FactionChampionLoc[i]); + else + for (uint8 i = 5; i < 10; i++) + vChampionJumpOrigin.push_back(FactionChampionLoc[i]); - std::vector<Position> vChampionJumpTarget; - for (uint8 i = 10; i < 20; i++) - vChampionJumpTarget.push_back(FactionChampionLoc[i]); - std::vector<uint32> vChampionEntries = SelectChampions(playerTeam); + std::vector<Position> vChampionJumpTarget; + for (uint8 i = 10; i < 20; i++) + vChampionJumpTarget.push_back(FactionChampionLoc[i]); + std::vector<uint32> vChampionEntries = SelectChampions(playerTeam); - for (uint8 i = 0; i < vChampionEntries.size(); ++i) - { - uint8 pos = urand(0, vChampionJumpTarget.size()-1); - if (Creature* temp = me->SummonCreature(vChampionEntries[i], vChampionJumpOrigin[urand(0, vChampionJumpOrigin.size()-1)], TEMPSUMMON_MANUAL_DESPAWN)) + for (uint8 i = 0; i < vChampionEntries.size(); ++i) { - Summons.Summon(temp); - temp->SetReactState(REACT_PASSIVE); - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); - if (playerTeam == ALLIANCE) + uint8 pos = urand(0, vChampionJumpTarget.size()-1); + if (Creature* temp = me->SummonCreature(vChampionEntries[i], vChampionJumpOrigin[urand(0, vChampionJumpOrigin.size()-1)], TEMPSUMMON_MANUAL_DESPAWN)) { - temp->SetHomePosition(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 0); - temp->GetMotionMaster()->MoveJump(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f); - temp->SetOrientation(0); - } - else - { - temp->SetHomePosition((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 3); - temp->GetMotionMaster()->MoveJump((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f); - temp->SetOrientation(3); + _summons.Summon(temp); + temp->SetReactState(REACT_PASSIVE); + temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + if (playerTeam == ALLIANCE) + { + temp->SetHomePosition(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 0); + temp->GetMotionMaster()->MoveJump(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f); + temp->SetOrientation(0); + } + else + { + temp->SetHomePosition((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 3); + temp->GetMotionMaster()->MoveJump((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f); + temp->SetOrientation(3); + } } + vChampionJumpTarget.erase(vChampionJumpTarget.begin()+pos); } - vChampionJumpTarget.erase(vChampionJumpTarget.begin()+pos); } - } - void SetData(uint32 uiType, uint32 uiData) - { - switch (uiType) + void SetData(uint32 uiType, uint32 uiData) { - case 0: - SummonChampions((Team)uiData); - break; - case 1: - for (std::list<uint64>::iterator i = Summons.begin(); i != Summons.end(); ++i) - { - if (Creature* temp = Unit::GetCreature(*me, *i)) + switch (uiType) + { + case 0: + SummonChampions((Team)uiData); + break; + case 1: + for (std::list<uint64>::iterator i = _summons.begin(); i != _summons.end(); ++i) { - temp->SetReactState(REACT_AGGRESSIVE); - temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); - } - } - break; - case 2: - switch (uiData) - { - case FAIL: - m_uiChampionsFailed++; - if (m_uiChampionsFailed + m_uiChampionsKilled >= Summons.size()) - { - instance->SetData(TYPE_CRUSADERS, FAIL); - Summons.DespawnAll(); - me->DespawnOrUnsummon(); - } - break; - case IN_PROGRESS: - if (!m_bInProgress) - { - m_uiChampionsNotStarted = 0; - m_uiChampionsFailed = 0; - m_uiChampionsKilled = 0; - m_bInProgress = true; - Summons.DoZoneInCombat(); - instance->SetData(TYPE_CRUSADERS, IN_PROGRESS); - } - break; - case DONE: - m_uiChampionsKilled++; - if (m_uiChampionsKilled == 1) - instance->SetData(TYPE_CRUSADERS, SPECIAL); - else if (m_uiChampionsKilled >= Summons.size()) + if (Creature* temp = Unit::GetCreature(*me, *i)) { - instance->SetData(TYPE_CRUSADERS, DONE); - Summons.DespawnAll(); - me->DespawnOrUnsummon(); + temp->SetReactState(REACT_AGGRESSIVE); + temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); } - break; - } - break; + } + break; + case 2: + switch (uiData) + { + case FAIL: + _championsFailed++; + if (_championsFailed + _championsKilled >= _summons.size()) + { + _instance->SetBossState(BOSS_CRUSADERS, FAIL); + _summons.DespawnAll(); + me->DespawnOrUnsummon(); + } + break; + case IN_PROGRESS: + if (!_inProgress) + { + _championsNotStarted = 0; + _championsFailed = 0; + _championsKilled = 0; + _inProgress = true; + _summons.DoZoneInCombat(); + _instance->SetBossState(BOSS_CRUSADERS, IN_PROGRESS); + } + break; + case DONE: + _championsKilled++; + if (_championsKilled == 1) + _instance->SetBossState(BOSS_CRUSADERS, SPECIAL); + else if (_championsKilled >= _summons.size()) + { + _instance->SetBossState(BOSS_CRUSADERS, DONE); + _summons.DespawnAll(); + me->DespawnOrUnsummon(); + } + break; + default: + break; + } + break; + default: + break; + } } - } - }; + private: + InstanceScript* _instance; + SummonList _summons; + uint32 _championsNotStarted; + uint32 _championsFailed; + uint32 _championsKilled; + bool _inProgress; + }; + CreatureAI* GetAI(Creature* creature) const + { + return new boss_toc_champion_controllerAI (creature); + } }; -struct boss_faction_championsAI : public ScriptedAI +struct boss_faction_championsAI : public BossAI { - boss_faction_championsAI(Creature* creature, uint32 aitype) : ScriptedAI(creature) + boss_faction_championsAI(Creature* creature, uint32 aitype) : BossAI(creature, BOSS_CRUSADERS) { - instance = creature->GetInstanceScript(); - mAIType = aitype; + _aiType = aitype; } - InstanceScript* instance; - - uint64 championControllerGUID; - uint32 mAIType; - uint32 ThreatTimer; - uint32 CCTimer; - void Reset() { - championControllerGUID = 0; - CCTimer = rand()%10000; - ThreatTimer = 5000; + _events.ScheduleEvent(EVENT_THREAT, 5*IN_MILLISECONDS); + if (IsHeroic() && (_aiType != AI_PET)) + _events.ScheduleEvent(EVENT_REMOVE_CC, 5*IN_MILLISECONDS); } void JustReachedHome() @@ -283,9 +567,9 @@ struct boss_faction_championsAI : public ScriptedAI float CalculateThreat(float distance, float armor, uint32 health) { - float dist_mod = (mAIType == AI_MELEE || mAIType == AI_PET) ? 15.0f/(15.0f + distance) : 1.0f; - float armor_mod = (mAIType == AI_MELEE || mAIType == AI_PET) ? armor / 16635.0f : 0.0f; - float eh = (health+1) * (1.0f + armor_mod); + float dist_mod = (_aiType == AI_MELEE || _aiType == AI_PET) ? 15.0f / (15.0f + distance) : 1.0f; + float armor_mod = (_aiType == AI_MELEE || _aiType == AI_PET) ? armor / 16635.0f : 0.0f; + float eh = (health + 1) * (1.0f + armor_mod); return dist_mod * 30000.0f / eh; } @@ -297,7 +581,7 @@ struct boss_faction_championsAI : public ScriptedAI Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && me->getThreatManager().getThreat(unit)) { - if (unit->GetTypeId()==TYPEID_PLAYER) + if (unit->GetTypeId() == TYPEID_PLAYER) { float threat = CalculateThreat(me->GetDistance2d(unit), (float)unit->GetArmor(), unit->GetHealth()); me->getThreatManager().modifyThreatPercent(unit, -100); @@ -311,8 +595,6 @@ struct boss_faction_championsAI : public ScriptedAI { if (me->getPowerType() == POWER_MANA) me->ModifyPower(POWER_MANA, me->GetMaxPower(POWER_MANA) / 3); - //else if (me->getPowerType() == POWER_ENERGY) - // me->ModifyPower(POWER_ENERGY, 100); } void RemoveCC() @@ -327,7 +609,7 @@ struct boss_faction_championsAI : public ScriptedAI void JustDied(Unit* /*killer*/) { - if (mAIType != AI_PET) + if (_aiType != AI_PET) if (instance) if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, DONE); @@ -336,7 +618,7 @@ struct boss_faction_championsAI : public ScriptedAI void EnterCombat(Unit* /*who*/) { DoCast(me, SPELL_ANTI_AOE, true); - me->SetInCombatWithZone(); + _EnterCombat(); if (instance) if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, IN_PROGRESS); @@ -376,7 +658,7 @@ struct boss_faction_championsAI : public ScriptedAI std::list<Creature*>::const_iterator itr = lst.begin(); if (lst.empty()) return NULL; - advance(itr, rand()%lst.size()); + advance(itr, rand() % lst.size()); return (*itr); } @@ -400,7 +682,7 @@ struct boss_faction_championsAI : public ScriptedAI std::list<HostileReference*>::const_iterator iter; uint32 count = 0; Unit* target; - for (iter = tList.begin(); iter!=tList.end(); ++iter) + for (iter = tList.begin(); iter != tList.end(); ++iter) { target = Unit::GetUnit(*me, (*iter)->getUnitGuid()); if (target && me->GetDistance2d(target) < distance) @@ -420,7 +702,7 @@ struct boss_faction_championsAI : public ScriptedAI me->SetInCombatWith(who); who->SetInCombatWith(me); - if (mAIType == AI_MELEE || mAIType == AI_PET) + if (_aiType == AI_MELEE || _aiType == AI_PET) DoStartMovement(who); else DoStartMovement(who, 20.0f); @@ -428,1642 +710,1666 @@ struct boss_faction_championsAI : public ScriptedAI } } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 diff) { - if (ThreatTimer < uiDiff) - { - UpdatePower(); - UpdateThreat(); - ThreatTimer = 4000; - } - else ThreatTimer -= uiDiff; + _events.Update(diff); - if (mAIType != AI_PET) + while (uint32 eventId = _events.ExecuteEvent()) { - if (CCTimer < uiDiff) - { - RemoveCC(); - CCTimer = 8000+rand()%2000; + switch (eventId) + { + case EVENT_THREAT: + UpdatePower(); + UpdateThreat(); + _events.ScheduleEvent(EVENT_THREAT, 4*IN_MILLISECONDS); + return; + case EVENT_REMOVE_CC: + if (me->HasBreakableByDamageCrowdControlAura()) + { + RemoveCC(); + _events.RescheduleEvent(EVENT_REMOVE_CC, 2*MINUTE*IN_MILLISECONDS); + } + else + _events.RescheduleEvent(EVENT_REMOVE_CC, 3*IN_MILLISECONDS); + return; + default: + return; } - else CCTimer -= uiDiff; } - if (mAIType == AI_MELEE || mAIType == AI_PET) DoMeleeAttackIfReady(); + if (_aiType == AI_MELEE || _aiType == AI_PET) + DoMeleeAttackIfReady(); } + + private: + uint32 _aiType; + // make sure that every bosses separate events dont mix with these _events + EventMap _events; }; /******************************************************************** HEALERS ********************************************************************/ -enum eDruidSpells -{ - SPELL_LIFEBLOOM = 66093, - SPELL_NOURISH = 66066, - SPELL_REGROWTH = 66067, - SPELL_REJUVENATION = 66065, - SPELL_TRANQUILITY = 66086, - SPELL_BARKSKIN = 65860, //1 min cd - SPELL_THORNS = 66068, - SPELL_NATURE_GRASP = 66071, //1 min cd, self buff -}; - class mob_toc_druid : public CreatureScript { -public: - mob_toc_druid() : CreatureScript("mob_toc_druid") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_druidAI (creature); - } - - struct mob_toc_druidAI : public boss_faction_championsAI - { - mob_toc_druidAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {} - - uint32 m_uiNatureGraspTimer; - uint32 m_uiTranquilityTimer; - uint32 m_uiBarkskinTimer; - uint32 m_uiCommonTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiNatureGraspTimer = IN_MILLISECONDS; - m_uiTranquilityTimer = IN_MILLISECONDS; - m_uiBarkskinTimer = IN_MILLISECONDS; - m_uiCommonTimer = IN_MILLISECONDS; - SetEquipmentSlots(false, 51799, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - } + public: + mob_toc_druid() : CreatureScript("mob_toc_druid") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_druidAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; + mob_toc_druidAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_LIFEBLOOM, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_NOURISH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_REGROWTH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_REJUVENATION, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_TRANQUILITY, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HEAL_BARKSKIN, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_THORNS, 2*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_NATURE_GRASP, urand(3*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + SetEquipmentSlots(false, 51799, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + } - if (m_uiNatureGraspTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_NATURE_GRASP); - m_uiNatureGraspTimer = urand(40*IN_MILLISECONDS, 80*IN_MILLISECONDS); - } else m_uiNatureGraspTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiTranquilityTimer <= uiDiff) - { - DoCastAOE(SPELL_TRANQUILITY); - m_uiTranquilityTimer = urand(40*IN_MILLISECONDS, 90*IN_MILLISECONDS); - } else m_uiTranquilityTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiBarkskinTimer <= uiDiff) - { - if (HealthBelowPct(50)) - DoCast(me, SPELL_BARKSKIN); - m_uiBarkskinTimer = urand(45*IN_MILLISECONDS, 90*IN_MILLISECONDS); - } else m_uiBarkskinTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 4)) + while (uint32 eventId = events.ExecuteEvent()) { - case 0: - DoCast(me, SPELL_LIFEBLOOM); - break; - case 1: - DoCast(me, SPELL_NOURISH); - break; - case 2: - DoCast(me, SPELL_REGROWTH); - break; - case 3: - DoCast(me, SPELL_REJUVENATION); - break; - case 4: - if (Creature* target = SelectRandomFriendlyMissingBuff(SPELL_THORNS)) - DoCast(target, SPELL_THORNS); - break; + switch (eventId) + { + case EVENT_LIFEBLOOM: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_LIFEBLOOM); + events.ScheduleEvent(EVENT_LIFEBLOOM, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_NOURISH: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_NOURISH); + events.ScheduleEvent(EVENT_NOURISH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_REGROWTH: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_REGROWTH); + events.ScheduleEvent(EVENT_REGROWTH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_REJUVENATION: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_REJUVENATION); + events.ScheduleEvent(EVENT_REJUVENATION, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_TRANQUILITY: + DoCastAOE(SPELL_TRANQUILITY); + events.ScheduleEvent(EVENT_TRANQUILITY, urand(15*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + return; + case EVENT_HEAL_BARKSKIN: + if (HealthBelowPct(30)) + { + DoCast(me, SPELL_BARKSKIN); + events.RescheduleEvent(EVENT_HEAL_BARKSKIN, 60*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_HEAL_BARKSKIN, 3*IN_MILLISECONDS); + return; + case EVENT_THORNS: + if (Creature* target = SelectRandomFriendlyMissingBuff(SPELL_THORNS)) + DoCast(target, SPELL_THORNS); + events.ScheduleEvent(EVENT_THORNS, urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + return; + case EVENT_NATURE_GRASP: + DoCast(me, SPELL_NATURE_GRASP); + events.ScheduleEvent(EVENT_NATURE_GRASP, 60*IN_MILLISECONDS); + return; + default: + return; + } } - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_druidAI (creature); } - }; - -}; - -enum eShamanSpells -{ - SPELL_HEALING_WAVE = 66055, - SPELL_RIPTIDE = 66053, - SPELL_SPIRIT_CLEANSE = 66056, //friendly only - SPELL_HEROISM = 65983, - SPELL_BLOODLUST = 65980, - SPELL_HEX = 66054, - SPELL_EARTH_SHIELD = 66063, - SPELL_EARTH_SHOCK = 65973, - AURA_EXHAUSTION = 57723, - AURA_SATED = 57724, }; class mob_toc_shaman : public CreatureScript { -public: - mob_toc_shaman() : CreatureScript("mob_toc_shaman") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_shamanAI (creature); - } - - struct mob_toc_shamanAI : public boss_faction_championsAI - { - mob_toc_shamanAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {} - - uint32 m_uiHeroismOrBloodlustTimer; - uint32 m_uiHexTimer; - uint32 m_uiCommonTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiHeroismOrBloodlustTimer = IN_MILLISECONDS; - m_uiHexTimer = IN_MILLISECONDS; - m_uiCommonTimer = IN_MILLISECONDS; - SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - } + public: + mob_toc_shaman() : CreatureScript("mob_toc_shaman") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_shamanAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; + mob_toc_shamanAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_HEALING_WAVE, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_RIPTIDE, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_SPIRIT_CLEANSE, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HEAL_BLOODLUST_HEROISM, 20*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_HEX, urand(5*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_EARTH_SHIELD, 1*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_HEAL_EARTH_SHOCK, urand(5*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + } - if (m_uiHeroismOrBloodlustTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (me->getFaction()) //Am i alliance? - { - if (!me->HasAura(AURA_EXHAUSTION)) - DoCastAOE(SPELL_HEROISM); - } - else - if (!me->HasAura(AURA_SATED)) - DoCastAOE(SPELL_BLOODLUST); - m_uiHeroismOrBloodlustTimer = 300*IN_MILLISECONDS; - } else m_uiHeroismOrBloodlustTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiHexTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_HEX); - m_uiHexTimer = urand(10*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else m_uiHexTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 5)) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case 0: case 1: - DoCast(me, SPELL_HEALING_WAVE); - break; - case 2: - DoCast(me, SPELL_RIPTIDE); - break; - case 3: - DoCast(me, SPELL_EARTH_SHOCK); - break; - case 4: - DoCast(me, SPELL_SPIRIT_CLEANSE); - break; - case 5: - if (Unit* target = SelectRandomFriendlyMissingBuff(SPELL_EARTH_SHIELD)) - DoCast(target, SPELL_EARTH_SHIELD); - break; + switch (eventId) + { + case EVENT_HEALING_WAVE: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_HEALING_WAVE); + events.ScheduleEvent(EVENT_HEALING_WAVE, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + return; + case EVENT_RIPTIDE: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_RIPTIDE); + events.ScheduleEvent(EVENT_RIPTIDE, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_SPIRIT_CLEANSE: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_SPIRIT_CLEANSE); + events.ScheduleEvent(EVENT_SPIRIT_CLEANSE, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_HEAL_BLOODLUST_HEROISM: + if (me->getFaction()) // alliance = 1 + { + if (!me->HasAura(AURA_EXHAUSTION)) + DoCastAOE(SPELL_HEROISM); + } + else + { + if (!me->HasAura(AURA_SATED)) + DoCastAOE(SPELL_BLOODLUST); + } + events.ScheduleEvent(EVENT_HEAL_BLOODLUST_HEROISM, 5*MINUTE*IN_MILLISECONDS); + return; + case EVENT_HEX: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + DoCast(target, SPELL_HEX); + events.ScheduleEvent(EVENT_HEX, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_EARTH_SHIELD: + if (Creature* target = SelectRandomFriendlyMissingBuff(SPELL_EARTH_SHIELD)) + DoCast(target, SPELL_EARTH_SHIELD); + events.ScheduleEvent(EVENT_EARTH_SHIELD, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_HEAL_EARTH_SHOCK: + if (Unit* target = SelectEnemyCaster(true)) + DoCast(target, SPELL_EARTH_SHOCK); + events.ScheduleEvent(EVENT_HEAL_EARTH_SHOCK, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + default: + return; + } } - m_uiCommonTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_shamanAI (creature); } - }; - -}; - -enum ePaladinSpells -{ - SPELL_HAND_OF_FREEDOM = 68757, //25 sec cd - SPELL_BUBBLE = 66010, //5 min cd - SPELL_CLEANSE = 66116, - SPELL_FLASH_OF_LIGHT = 66113, - SPELL_HOLY_LIGHT = 66112, - SPELL_HOLY_SHOCK = 66114, - SPELL_HAND_OF_PROTECTION = 66009, - SPELL_HAMMER_OF_JUSTICE = 66613, }; class mob_toc_paladin : public CreatureScript { -public: - mob_toc_paladin() : CreatureScript("mob_toc_paladin") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_paladinAI (creature); - } - - struct mob_toc_paladinAI : public boss_faction_championsAI - { - mob_toc_paladinAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {} - - uint32 m_uiBubbleTimer; - uint32 m_uiHandOfProtectionTimer; - uint32 m_uiHolyShockTimer; - uint32 m_uiHandOfFreedomTimer; - uint32 m_uiHammerOfJusticeTimer; - uint32 m_uiCommonTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiBubbleTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS); - m_uiHandOfProtectionTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS); - m_uiHolyShockTimer = urand(6*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiHandOfFreedomTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS); - m_uiHammerOfJusticeTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - SetEquipmentSlots(false, 50771, 47079, EQUIP_NO_CHANGE); - } + public: + mob_toc_paladin() : CreatureScript("mob_toc_paladin") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_paladinAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; - - if (m_uiBubbleTimer <= uiDiff) - { - //cast bubble at 20% hp - if (HealthBelowPct(20)) - DoCast(me, SPELL_BUBBLE); - m_uiBubbleTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS); - } else m_uiBubbleTimer -= uiDiff; + mob_toc_paladinAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_HAND_OF_FREEDOM, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HEAL_DIVINE_SHIELD, 20*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_CLEANSE, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_FLASH_OF_LIGHT, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HOLY_LIGHT, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HOLY_SHOCK, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HEAL_HAND_OF_PROTECTION, urand(30*IN_MILLISECONDS, 60*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HAMMER_OF_JUSTICE, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + SetEquipmentSlots(false, 50771, 47079, EQUIP_NO_CHANGE); + } - if (m_uiHandOfProtectionTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (Unit* target = DoSelectLowestHpFriendly(40.0f)) - if (target->HealthBelowPct(15)) - DoCast(target, SPELL_HAND_OF_PROTECTION); - m_uiHandOfProtectionTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS); - } else m_uiHandOfProtectionTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiHolyShockTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_HOLY_SHOCK); - m_uiHolyShockTimer = urand(6*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiHolyShockTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiHandOfFreedomTimer <= uiDiff) - { - if (Unit* target = SelectRandomFriendlyMissingBuff(SPELL_HAND_OF_FREEDOM)) - DoCast(target, SPELL_HAND_OF_FREEDOM); - m_uiHandOfFreedomTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else m_uiHandOfFreedomTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiHammerOfJusticeTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_HAMMER_OF_JUSTICE); - m_uiHammerOfJusticeTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiHammerOfJusticeTimer -= uiDiff; - - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 4)) + while (uint32 eventId = events.ExecuteEvent()) { - case 0: case 1: - DoCast(me, SPELL_FLASH_OF_LIGHT); - break; - case 2: case 3: - DoCast(me, SPELL_HOLY_LIGHT); - break; - case 4: - DoCast(me, SPELL_CLEANSE); - break; + switch (eventId) + { + case EVENT_HAND_OF_FREEDOM: + if (Unit* target = SelectRandomFriendlyMissingBuff(SPELL_HAND_OF_FREEDOM)) + DoCast(target, SPELL_HAND_OF_FREEDOM); + events.ScheduleEvent(EVENT_HAND_OF_FREEDOM, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_HEAL_DIVINE_SHIELD: + if (HealthBelowPct(30) && !me->HasAura(SPELL_FORBEARANCE)) + { + DoCast(me, SPELL_DIVINE_SHIELD); + events.RescheduleEvent(EVENT_HEAL_DIVINE_SHIELD, 5*MINUTE*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_HEAL_DIVINE_SHIELD, 5*IN_MILLISECONDS); + return; + case EVENT_CLEANSE: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_CLEANSE); + events.ScheduleEvent(EVENT_CLEANSE, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_FLASH_OF_LIGHT: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_FLASH_OF_LIGHT); + events.ScheduleEvent(EVENT_FLASH_OF_LIGHT, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + return; + case EVENT_HOLY_LIGHT: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_HOLY_LIGHT); + events.ScheduleEvent(EVENT_HOLY_LIGHT, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + return; + case EVENT_HOLY_SHOCK: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_HOLY_SHOCK); + events.ScheduleEvent(EVENT_HOLY_SHOCK, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_HEAL_HAND_OF_PROTECTION: + if (Unit* target = DoSelectLowestHpFriendly(30.0f)) + { + if (!target->HasAura(SPELL_FORBEARANCE)) + { + DoCast(target, SPELL_HAND_OF_PROTECTION); + events.RescheduleEvent(EVENT_HEAL_HAND_OF_PROTECTION, 5*MINUTE*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_HEAL_HAND_OF_PROTECTION, 3*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_HEAL_HAND_OF_PROTECTION, 10*IN_MILLISECONDS); + return; + case EVENT_HAMMER_OF_JUSTICE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 15.0f, true)) + DoCast(target, SPELL_HAMMER_OF_JUSTICE); + events.ScheduleEvent(EVENT_HAMMER_OF_JUSTICE, 40*IN_MILLISECONDS); + return; + default: + return; + } } - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_paladinAI (creature); } - }; - -}; - -enum ePriestSpells -{ - SPELL_RENEW = 66177, - SPELL_SHIELD = 66099, - SPELL_FLASH_HEAL = 66104, - SPELL_DISPEL = 65546, - SPELL_PSYCHIC_SCREAM = 65543, - SPELL_MANA_BURN = 66100, }; class mob_toc_priest : public CreatureScript { -public: - mob_toc_priest() : CreatureScript("mob_toc_priest") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_priestAI (creature); - } - - struct mob_toc_priestAI : public boss_faction_championsAI - { - mob_toc_priestAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {} - - uint32 m_uiPsychicScreamTimer; - uint32 m_uiCommonTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiPsychicScreamTimer = IN_MILLISECONDS; - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - } + public: + mob_toc_priest() : CreatureScript("mob_toc_priest") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_priestAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; + mob_toc_priestAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_RENEW, urand(3*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_SHIELD, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_FLASH_HEAL, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HEAL_DISPEL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HEAL_PSYCHIC_SCREAM, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_MANA_BURN, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_PENANCE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + } - if (m_uiPsychicScreamTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (EnemiesInRange(10.0f) > 2) - DoCastAOE(SPELL_PSYCHIC_SCREAM); - m_uiPsychicScreamTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiPsychicScreamTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 5)) + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case 0: - DoCast(me, SPELL_RENEW); - break; - case 1: - DoCast(me, SPELL_SHIELD); - break; - case 2: case 3: - DoCast(me, SPELL_FLASH_HEAL); - break; - case 4: - if (Unit* target = urand(0, 1) ? SelectTarget(SELECT_TARGET_RANDOM, 0) : DoSelectLowestHpFriendly(40.0f)) - DoCast(target, SPELL_DISPEL); - break; - case 5: - DoCast(me, SPELL_MANA_BURN); - break; + switch (eventId) + { + case EVENT_RENEW: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_RENEW); + events.ScheduleEvent(EVENT_RENEW, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + return; + case EVENT_SHIELD: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_SHIELD); + events.ScheduleEvent(EVENT_SHIELD, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_FLASH_HEAL: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_FLASH_HEAL); + events.ScheduleEvent(EVENT_FLASH_HEAL, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + return; + case EVENT_HEAL_DISPEL: + if (Unit* target = urand(0, 1) ? SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) : DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_DISPEL); + events.ScheduleEvent(EVENT_HEAL_DISPEL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_HEAL_PSYCHIC_SCREAM: + if (EnemiesInRange(10.0f) >= 2) + DoCastAOE(SPELL_PSYCHIC_SCREAM); + events.ScheduleEvent(EVENT_HEAL_PSYCHIC_SCREAM, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_MANA_BURN: + if (Unit* target = SelectEnemyCaster(false)) + DoCast(target, SPELL_MANA_BURN); + events.ScheduleEvent(EVENT_MANA_BURN, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_PENANCE: + if (Unit* target = DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_PENANCE); + events.ScheduleEvent(EVENT_PENANCE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + default: + return; + } } - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_priestAI (creature); } - }; - }; /******************************************************************** RANGED ********************************************************************/ -enum eShadowPriestSpells -{ - SPELL_SILENCE = 65542, - SPELL_VAMPIRIC_TOUCH = 65490, - SPELL_SW_PAIN = 65541, - SPELL_MIND_FLAY = 65488, - SPELL_MIND_BLAST = 65492, - SPELL_HORROR = 65545, - SPELL_DISPERSION = 65544, - SPELL_SHADOWFORM = 16592, -}; - class mob_toc_shadow_priest : public CreatureScript { -public: - mob_toc_shadow_priest() : CreatureScript("mob_toc_shadow_priest") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_shadow_priestAI (creature); - } - - struct mob_toc_shadow_priestAI : public boss_faction_championsAI - { - mob_toc_shadow_priestAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {} - - uint32 m_uiPsychicScreamTimer; - uint32 m_uiDispersionTimer; - uint32 m_uiSilenceTimer; - uint32 m_uiMindBlastTimer; - uint32 m_uiCommonTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiPsychicScreamTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS); - m_uiDispersionTimer = urand(1*IN_MILLISECONDS, 180*IN_MILLISECONDS); - m_uiSilenceTimer = urand(8*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiMindBlastTimer = urand(3*IN_MILLISECONDS, 8*IN_MILLISECONDS); - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - SetEquipmentSlots(false, 50040, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - DoCast(me, SPELL_SHADOWFORM); - } - - void EnterCombat(Unit* who) - { - boss_faction_championsAI::EnterCombat(who); - } + public: + mob_toc_shadow_priest() : CreatureScript("mob_toc_shadow_priest") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_shadow_priestAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; - - if (m_uiPsychicScreamTimer <= uiDiff) - { - if (EnemiesInRange(10.0f) > 2) - DoCastAOE(SPELL_PSYCHIC_SCREAM); - m_uiPsychicScreamTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiPsychicScreamTimer -= uiDiff; + mob_toc_shadow_priestAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_SILENCE, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_VAMPIRIC_TOUCH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_SW_PAIN, urand(3*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_MIND_BLAST, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HORROR, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DISPERSION, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DPS_DISPEL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DPS_PSYCHIC_SCREAM, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + SetEquipmentSlots(false, 50040, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + DoCast(me, SPELL_SHADOWFORM); + } - if (m_uiDispersionTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (HealthBelowPct(20)) - DoCast(me, SPELL_DISPERSION); - m_uiDispersionTimer = urand(1*IN_MILLISECONDS, 180*IN_MILLISECONDS); - } else m_uiDispersionTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiSilenceTimer <= uiDiff) - { - if (Unit* target = SelectEnemyCaster(false)) - DoCast(target, SPELL_SILENCE); - m_uiSilenceTimer = urand(8*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiSilenceTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiMindBlastTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_MIND_BLAST); - m_uiMindBlastTimer = urand(3*IN_MILLISECONDS, 8*IN_MILLISECONDS); - } else m_uiMindBlastTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 4)) + while (uint32 eventId = events.ExecuteEvent()) { - case 0: case 1: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_MIND_FLAY); - break; - case 2: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_VAMPIRIC_TOUCH); - break; - case 3: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SW_PAIN); - break; - case 4: - if (Unit* target = urand(0, 1) ? SelectTarget(SELECT_TARGET_RANDOM, 0) : DoSelectLowestHpFriendly(40.0f)) - DoCast(target, SPELL_DISPEL); - break; + switch (eventId) + { + case EVENT_SILENCE: + if (Unit* target = SelectEnemyCaster(true)) + DoCast(target, SPELL_SILENCE); + events.ScheduleEvent(EVENT_SILENCE, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_VAMPIRIC_TOUCH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + DoCast(target, SPELL_VAMPIRIC_TOUCH); + events.ScheduleEvent(EVENT_VAMPIRIC_TOUCH, urand(10*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_SW_PAIN: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + DoCast(target, SPELL_SW_PAIN); + events.ScheduleEvent(EVENT_SW_PAIN, urand(10*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_MIND_BLAST: + DoCastVictim(SPELL_MIND_BLAST); + events.ScheduleEvent(EVENT_MIND_BLAST, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_HORROR: + DoCastVictim(SPELL_HORROR); + events.ScheduleEvent(EVENT_HORROR, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_DISPERSION: + if (HealthBelowPct(40)) + { + DoCast(me, SPELL_DISPERSION); + events.RescheduleEvent(EVENT_DISPERSION, 180*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_DISPERSION, 5*IN_MILLISECONDS); + return; + case EVENT_DPS_DISPEL: + if (Unit* target = urand(0, 1) ? SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) : DoSelectLowestHpFriendly(40.0f)) + DoCast(target, SPELL_DISPEL); + events.ScheduleEvent(EVENT_DPS_DISPEL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_DPS_PSYCHIC_SCREAM: + if (EnemiesInRange(10.0f) >= 2) + DoCastAOE(SPELL_PSYCHIC_SCREAM); + events.ScheduleEvent(EVENT_DPS_PSYCHIC_SCREAM, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + default: + return; + } } - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; + DoSpellAttackIfReady(SPELL_MIND_FLAY); + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_shadow_priestAI (creature); } - }; - -}; - -enum WarlockSpells -{ - SPELL_HELLFIRE = 65816, - SPELL_CORRUPTION = 65810, - SPELL_CURSE_OF_AGONY = 65814, - SPELL_CURSE_OF_EXHAUSTION = 65815, - SPELL_FEAR = 65809, // 8s - SPELL_SEARING_PAIN = 65819, - SPELL_SHADOW_BOLT = 65821, - SPELL_UNSTABLE_AFFLICTION = 65812, // 15s - SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813, - SPELL_SUMMON_FELHUNTER = 67514, }; class mob_toc_warlock : public CreatureScript { -public: - mob_toc_warlock() : CreatureScript("mob_toc_warlock") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_warlockAI (creature); - } - - struct mob_toc_warlockAI : public boss_faction_championsAI - { - mob_toc_warlockAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED), Summons(me) {} - - SummonList Summons; - - uint32 m_uiFearTimer; - uint32 m_uiHellfireTimer; - uint32 m_uiUnstableAfflictionTimer; - uint32 m_uiCommonTimer; - uint32 m_uiSummonPetTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiFearTimer = urand(4*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiHellfireTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - m_uiUnstableAfflictionTimer = urand(2*IN_MILLISECONDS, 10*IN_MILLISECONDS); - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - - m_uiSummonPetTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - DoCast(SPELL_SUMMON_FELHUNTER); - } + public: + mob_toc_warlock() : CreatureScript("mob_toc_warlock") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_warlockAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; + mob_toc_warlockAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_HELLFIRE, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_CORRUPTION, urand(2*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_CURSE_OF_AGONY, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_CURSE_OF_EXHAUSTION, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_FEAR, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_SEARING_PAIN, urand(5*IN_MILLISECONDS, 12*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_UNSTABLE_AFFLICTION, urand(7*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + } - if (m_uiFearTimer <= uiDiff) + void EnterCombat(Unit* who) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_FEAR); - m_uiFearTimer = urand(4*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiFearTimer -= uiDiff; + boss_faction_championsAI::EnterCombat(who); + DoCast(SPELL_SUMMON_FELHUNTER); + } - if (m_uiHellfireTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (EnemiesInRange(10.0f) > 2) - DoCastAOE(SPELL_HELLFIRE); - m_uiHellfireTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiHellfireTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiUnstableAfflictionTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_UNSTABLE_AFFLICTION); - m_uiUnstableAfflictionTimer = urand(2*IN_MILLISECONDS, 10*IN_MILLISECONDS); - } else m_uiUnstableAfflictionTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiSummonPetTimer <= uiDiff) - { - m_uiSummonPetTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiSummonPetTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 5)) + while (uint32 eventId = events.ExecuteEvent()) { - case 0: case 1: - DoCastVictim(SPELL_SHADOW_BOLT); - break; - case 2: - DoCastVictim(SPELL_SEARING_PAIN); - break; - case 3: - DoCastVictim(SPELL_CORRUPTION); - break; - case 4: - DoCastVictim(SPELL_CURSE_OF_AGONY); - break; - case 5: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_CURSE_OF_EXHAUSTION); - break; + switch (eventId) + { + case EVENT_HELLFIRE: + if (EnemiesInRange(10.0f) >= 2) + DoCastAOE(SPELL_HELLFIRE); + events.ScheduleEvent(EVENT_HELLFIRE, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_CORRUPTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + DoCast(target, SPELL_CORRUPTION); + events.ScheduleEvent(EVENT_CORRUPTION, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_CURSE_OF_AGONY: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + DoCast(target, SPELL_CURSE_OF_AGONY); + events.ScheduleEvent(EVENT_CURSE_OF_AGONY, urand(20*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_CURSE_OF_EXHAUSTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + DoCast(target, SPELL_CURSE_OF_EXHAUSTION); + events.ScheduleEvent(EVENT_CURSE_OF_EXHAUSTION, urand(20*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_FEAR: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true)) + DoCast(target, SPELL_FEAR); + events.ScheduleEvent(EVENT_FEAR, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_SEARING_PAIN: + DoCastVictim(SPELL_SEARING_PAIN); + events.ScheduleEvent(EVENT_SEARING_PAIN, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_UNSTABLE_AFFLICTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + DoCast(target, SPELL_UNSTABLE_AFFLICTION); + events.ScheduleEvent(EVENT_UNSTABLE_AFFLICTION, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + default: + return; + } } - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; - boss_faction_championsAI::UpdateAI(uiDiff); - } - }; - -}; + DoSpellAttackIfReady(SPELL_SHADOW_BOLT); + } + }; -enum eMageSpells -{ - SPELL_ARCANE_BARRAGE = 65799, //3s - SPELL_ARCANE_BLAST = 65791, - SPELL_ARCANE_EXPLOSION = 65800, - SPELL_BLINK = 65793, //15s - SPELL_COUNTERSPELL = 65790, //24s - SPELL_FROST_NOVA = 65792, //25s - SPELL_FROSTBOLT = 65807, - SPELL_ICE_BLOCK = 65802, //5min - SPELL_POLYMORPH = 65801, //15s + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_warlockAI (creature); + } }; class mob_toc_mage : public CreatureScript { -public: - mob_toc_mage() : CreatureScript("mob_toc_mage") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_mageAI (creature); - } - - struct mob_toc_mageAI : public boss_faction_championsAI - { - mob_toc_mageAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {} - - uint32 m_uiCounterspellTimer; - uint32 m_uiBlinkTimer; - uint32 m_uiIceBlockTimer; - uint32 m_uiPolymorphTimer; - uint32 m_uiCommonTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiCounterspellTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiBlinkTimer = urand(7*IN_MILLISECONDS, 25*IN_MILLISECONDS); - m_uiIceBlockTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS); - m_uiPolymorphTimer = urand(15*IN_MILLISECONDS, 40*IN_MILLISECONDS); - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - SetEquipmentSlots(false, 47524, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - } + public: + mob_toc_mage() : CreatureScript("mob_toc_mage") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_mageAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; + mob_toc_mageAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(1*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_ARCANE_BLAST, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_BLINK, urand(15*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_COUNTERSPELL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_FROST_NOVA, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_ICE_BLOCK, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_POLYMORPH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + SetEquipmentSlots(false, 47524, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + } - if (m_uiCounterspellTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (Unit* target = SelectEnemyCaster(false)) - DoCast(target, SPELL_COUNTERSPELL); - m_uiCounterspellTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiCounterspellTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiBlinkTimer <= uiDiff) - { - if (HealthBelowPct(50) && EnemiesInRange(10.0f) > 3) - { - DoCastAOE(SPELL_FROST_NOVA); - DoCast(SPELL_BLINK); - } - m_uiBlinkTimer = urand(7*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiBlinkTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiIceBlockTimer <= uiDiff) - { - if (HealthBelowPct(20)) - DoCast(me, SPELL_ICE_BLOCK); - m_uiIceBlockTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS); - } else m_uiIceBlockTimer -= uiDiff; - - if (m_uiPolymorphTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_POLYMORPH); - m_uiPolymorphTimer = urand(15*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else m_uiPolymorphTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 2)) + while (uint32 eventId = events.ExecuteEvent()) { - case 0: - DoCast(me, SPELL_ARCANE_BARRAGE); - break; - case 1: - DoCastVictim(SPELL_ARCANE_BLAST); - break; - case 2: - DoCastVictim(SPELL_FROSTBOLT); - break; + switch (eventId) + { + case EVENT_ARCANE_BARRAGE: + DoCastVictim(SPELL_ARCANE_BARRAGE); + events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(5*IN_MILLISECONDS, 7*IN_MILLISECONDS)); + return; + case EVENT_ARCANE_BLAST: + DoCastVictim(SPELL_ARCANE_BLAST); + events.ScheduleEvent(EVENT_ARCANE_BLAST, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_ARCANE_EXPLOSION: + if (EnemiesInRange(10.0f) >= 2) + DoCastAOE(SPELL_ARCANE_EXPLOSION); + events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_BLINK: + if (EnemiesInRange(10.0f) >= 2) + DoCast(SPELL_BLINK); + events.ScheduleEvent(EVENT_BLINK, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_COUNTERSPELL: + if (Unit* target = SelectEnemyCaster(true)) + DoCast(target, SPELL_COUNTERSPELL); + events.ScheduleEvent(EVENT_COUNTERSPELL, 24*IN_MILLISECONDS); + return; + case EVENT_FROST_NOVA: + if (EnemiesInRange(10.0f) >= 2) + DoCastAOE(SPELL_FROST_NOVA); + events.ScheduleEvent(EVENT_FROST_NOVA, 25*IN_MILLISECONDS); + return; + case EVENT_ICE_BLOCK: + if (HealthBelowPct(30)) + { + DoCast(SPELL_ICE_BLOCK); + events.RescheduleEvent(EVENT_ICE_BLOCK, 5*MINUTE*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_ICE_BLOCK, 5*IN_MILLISECONDS); + return; + case EVENT_POLYMORPH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + DoCast(target, SPELL_POLYMORPH); + events.ScheduleEvent(EVENT_POLYMORPH, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + default: + return; + } } - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; + DoSpellAttackIfReady(SPELL_FROSTBOLT); + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_mageAI (creature); } - }; - -}; - -enum eHunterSpells -{ - SPELL_AIMED_SHOT = 65883, - SPELL_DETERRENCE = 65871, //90s - SPELL_DISENGAGE = 65869, //30s - SPELL_EXPLOSIVE_SHOT = 65866, - SPELL_FROST_TRAP = 65880, //30s - SPELL_SHOOT = 65868, //1.7s - SPELL_STEADY_SHOT = 65867, //3s - SPELL_WING_CLIP = 66207, //6s - SPELL_WYVERN_STING = 65877, //60s - SPELL_CALL_PET = 67777, }; class mob_toc_hunter : public CreatureScript { -public: - mob_toc_hunter() : CreatureScript("mob_toc_hunter") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_hunterAI (creature); - } - - struct mob_toc_hunterAI : public boss_faction_championsAI - { - mob_toc_hunterAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED), Summons(me) {} - - SummonList Summons; - - uint32 m_uiDisengageTimer; - uint32 m_uiDeterrenceTimer; - uint32 m_uiWyvernStingTimer; - uint32 m_uiFrostTrapTimer; - uint32 m_uiWingClipTimer; - uint32 m_uiCommonTimer; - uint32 m_uiSummonPetTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiDisengageTimer = urand(12*IN_MILLISECONDS, 20*IN_MILLISECONDS); - m_uiDeterrenceTimer = urand(20*IN_MILLISECONDS, 120*IN_MILLISECONDS); - m_uiWyvernStingTimer = urand(7*IN_MILLISECONDS, 60*IN_MILLISECONDS); - m_uiFrostTrapTimer = urand(12*IN_MILLISECONDS, 30*IN_MILLISECONDS); - m_uiWingClipTimer = urand(4*IN_MILLISECONDS, 8*IN_MILLISECONDS); - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - SetEquipmentSlots(false, 47156, EQUIP_NO_CHANGE, 48711); - - m_uiSummonPetTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - DoCast(SPELL_CALL_PET); - } + public: + mob_toc_hunter() : CreatureScript("mob_toc_hunter") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_hunterAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; - - if (m_uiDisengageTimer <= uiDiff) - { - if (EnemiesInRange(10.0f) > 3) - DoCast(SPELL_DISENGAGE); - m_uiDisengageTimer = urand(12*IN_MILLISECONDS, 20*IN_MILLISECONDS); - } else m_uiDisengageTimer -= uiDiff; + mob_toc_hunterAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_AIMED_SHOT, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DETERRENCE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DISENGAGE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_EXPLOSIVE_SHOT, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_FROST_TRAP, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_STEADY_SHOT, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_WING_CLIP, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_WYVERN_STING, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + SetEquipmentSlots(false, 47156, EQUIP_NO_CHANGE, 48711); + } - if (m_uiDeterrenceTimer <= uiDiff) + void EnterCombat(Unit* who) { - if (HealthBelowPct(20)) - DoCast(SPELL_DETERRENCE); - m_uiDeterrenceTimer = urand(20*IN_MILLISECONDS, 120*IN_MILLISECONDS); - } else m_uiDeterrenceTimer -= uiDiff; + boss_faction_championsAI::EnterCombat(who); + DoCast(SPELL_CALL_PET); + } - if (m_uiWyvernStingTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - DoCastVictim(SPELL_WYVERN_STING); - m_uiWyvernStingTimer = urand(7*IN_MILLISECONDS, 60*IN_MILLISECONDS); - } else m_uiWyvernStingTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiFrostTrapTimer <= uiDiff) - { - DoCast(SPELL_FROST_TRAP); - m_uiFrostTrapTimer = urand(12*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiFrostTrapTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiWingClipTimer <= uiDiff) - { - if (me->GetDistance2d(me->getVictim()) < 5.0f) - DoCastVictim(SPELL_WING_CLIP); - m_uiWingClipTimer = urand(4*IN_MILLISECONDS, 8*IN_MILLISECONDS); - } else m_uiWingClipTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiSummonPetTimer <= uiDiff) - { - m_uiSummonPetTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiSummonPetTimer -= uiDiff; - - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 3)) + while (uint32 eventId = events.ExecuteEvent()) { - case 0: case 1: - DoCastVictim(SPELL_SHOOT); - break; - case 2: - DoCastVictim(SPELL_EXPLOSIVE_SHOT); - break; - case 3: - DoCastVictim(SPELL_AIMED_SHOT); - break; + switch (eventId) + { + case EVENT_AIMED_SHOT: + DoCastVictim(SPELL_AIMED_SHOT); + events.ScheduleEvent(EVENT_AIMED_SHOT, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_DETERRENCE: + if (HealthBelowPct(30)) + { + DoCast(SPELL_DETERRENCE); + events.RescheduleEvent(EVENT_DETERRENCE, 150*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_DETERRENCE, 10*IN_MILLISECONDS); + return; + case EVENT_DISENGAGE: + if (EnemiesInRange(10.0f) >= 2) + DoCast(SPELL_DISENGAGE); + events.ScheduleEvent(EVENT_DISENGAGE, 30*IN_MILLISECONDS); + return; + case EVENT_EXPLOSIVE_SHOT: + DoCastVictim(SPELL_EXPLOSIVE_SHOT); + events.ScheduleEvent(EVENT_EXPLOSIVE_SHOT, urand(6*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + return; + case EVENT_FROST_TRAP: + if (EnemiesInRange(10.0f) >= 2) + DoCastAOE(SPELL_FROST_TRAP); + events.ScheduleEvent(EVENT_FROST_TRAP, 30*IN_MILLISECONDS); + return; + case EVENT_STEADY_SHOT: + DoCastVictim(SPELL_STEADY_SHOT); + events.ScheduleEvent(EVENT_STEADY_SHOT, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_WING_CLIP: + if (me->GetDistance2d(me->getVictim()) < 6.0f) + DoCastVictim(SPELL_WING_CLIP); + events.ScheduleEvent(EVENT_WING_CLIP, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_WYVERN_STING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + DoCast(target, SPELL_WYVERN_STING); + events.ScheduleEvent(EVENT_WYVERN_STING, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + default: + return; + } } - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; + DoSpellAttackIfReady(SPELL_SHOOT); + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_hunterAI (creature); } - }; - -}; - -enum eBoomkinSpells -{ - SPELL_CYCLONE = 65859, //6s - SPELL_ENTANGLING_ROOTS = 65857, //10s - SPELL_FAERIE_FIRE = 65863, - SPELL_FORCE_OF_NATURE = 65861, //180s - SPELL_INSECT_SWARM = 65855, - SPELL_MOONFIRE = 65856, //5s - SPELL_STARFIRE = 65854, - SPELL_WRATH = 65862, }; class mob_toc_boomkin : public CreatureScript { -public: - mob_toc_boomkin() : CreatureScript("mob_toc_boomkin") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_boomkinAI (creature); - } - - struct mob_toc_boomkinAI : public boss_faction_championsAI - { - mob_toc_boomkinAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {} - - uint32 m_uiBarkskinTimer; - uint32 m_uiCycloneTimer; - uint32 m_uiEntanglingRootsTimer; - uint32 m_uiFaerieFireTimer; - uint32 m_uiCommonTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiBarkskinTimer = urand(5*IN_MILLISECONDS, 120*IN_MILLISECONDS); - m_uiCycloneTimer = urand(5*IN_MILLISECONDS, 40*IN_MILLISECONDS); - m_uiEntanglingRootsTimer = urand(5*IN_MILLISECONDS, 40*IN_MILLISECONDS); - m_uiFaerieFireTimer = urand(10*IN_MILLISECONDS, 40*IN_MILLISECONDS); - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - SetEquipmentSlots(false, 50966, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - } + public: + mob_toc_boomkin() : CreatureScript("mob_toc_boomkin") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_boomkinAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; + mob_toc_boomkinAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {} - if (m_uiBarkskinTimer <= uiDiff) + void Reset() { - if (HealthBelowPct(50)) - DoCast(me, SPELL_BARKSKIN); - m_uiBarkskinTimer = urand(5*IN_MILLISECONDS, 120*IN_MILLISECONDS); - } else m_uiBarkskinTimer -= uiDiff; + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_CYCLONE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_ENTANGLING_ROOTS, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_FAERIE_FIRE, urand(2*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_FORCE_OF_NATURE, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_INSECT_SWARM, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_MOONFIRE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_STARFIRE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DPS_BARKSKIN, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS)); - if (m_uiCycloneTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_CYCLONE); - m_uiCycloneTimer = urand(5*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else m_uiCycloneTimer -= uiDiff; + SetEquipmentSlots(false, 50966, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + } - if (m_uiEntanglingRootsTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_ENTANGLING_ROOTS); - m_uiEntanglingRootsTimer = urand(5*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else m_uiEntanglingRootsTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiFaerieFireTimer <= uiDiff) - { - DoCastVictim(SPELL_FAERIE_FIRE); - m_uiFaerieFireTimer = urand(10*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else m_uiFaerieFireTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiCommonTimer <= uiDiff) - { - switch (urand(0, 6)) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case 0: case 1: - DoCastVictim(SPELL_MOONFIRE); - break; - case 2: - DoCastVictim(SPELL_INSECT_SWARM); - break; - case 3: - DoCastVictim(SPELL_STARFIRE); - break; - case 4: case 5: case 6: - DoCastVictim(SPELL_WRATH); - break; + switch (eventId) + { + case EVENT_CYCLONE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + DoCast(target, SPELL_CYCLONE); + events.ScheduleEvent(EVENT_CYCLONE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_ENTANGLING_ROOTS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + DoCast(target, SPELL_ENTANGLING_ROOTS); + events.ScheduleEvent(EVENT_ENTANGLING_ROOTS, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_FAERIE_FIRE: + DoCastVictim(SPELL_FAERIE_FIRE); + events.ScheduleEvent(EVENT_FAERIE_FIRE, urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + return; + case EVENT_FORCE_OF_NATURE: + DoCastVictim(SPELL_FORCE_OF_NATURE); + events.ScheduleEvent(EVENT_FORCE_OF_NATURE, 180*IN_MILLISECONDS); + return; + case EVENT_INSECT_SWARM: + DoCastVictim(SPELL_INSECT_SWARM); + events.ScheduleEvent(EVENT_INSECT_SWARM, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_MOONFIRE: + DoCastVictim(SPELL_MOONFIRE); + events.ScheduleEvent(EVENT_MOONFIRE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_STARFIRE: + DoCastVictim(SPELL_STARFIRE); + events.ScheduleEvent(EVENT_STARFIRE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_DPS_BARKSKIN: + if (HealthBelowPct(30)) + { + DoCast(me, SPELL_BARKSKIN); + events.RescheduleEvent(EVENT_DPS_BARKSKIN, 60*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_DPS_BARKSKIN, 5*IN_MILLISECONDS); + return; + default: + return; + } } - m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiCommonTimer -= uiDiff; + DoSpellAttackIfReady(SPELL_WRATH); + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_boomkinAI (creature); } - }; - }; /******************************************************************** MELEE ********************************************************************/ -enum eWarriorSpells -{ - SPELL_BLADESTORM = 65947, - SPELL_INTIMIDATING_SHOUT = 65930, - SPELL_MORTAL_STRIKE = 65926, - SPELL_CHARGE = 68764, - SPELL_DISARM = 65935, - SPELL_OVERPOWER = 65924, - SPELL_SUNDER_ARMOR = 65936, - SPELL_SHATTERING_THROW = 65940, - SPELL_RETALIATION = 65932, -}; - class mob_toc_warrior : public CreatureScript { -public: - mob_toc_warrior() : CreatureScript("mob_toc_warrior") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_warriorAI (creature); - } - - struct mob_toc_warriorAI : public boss_faction_championsAI - { - mob_toc_warriorAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} - - uint32 m_uiBladestormTimer; - uint32 m_uiIntimidatingShoutTimer; - uint32 m_uiMortalStrikeTimer; - uint32 m_uiSunderArmorTimer; - uint32 m_uiChargeTimer; - uint32 m_uiRetaliationTimer; - uint32 m_uiOverpowerTimer; - uint32 m_uiShatteringThrowTimer; - uint32 m_uiDisarmTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiBladestormTimer = urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS); - m_uiIntimidatingShoutTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS); - m_uiMortalStrikeTimer = urand(6*IN_MILLISECONDS, 25*IN_MILLISECONDS); - m_uiSunderArmorTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS); - m_uiChargeTimer = urand(3*IN_MILLISECONDS, 25*IN_MILLISECONDS); - m_uiRetaliationTimer = urand(30*IN_MILLISECONDS, 60*IN_MILLISECONDS); - m_uiOverpowerTimer = urand(30*IN_MILLISECONDS, 90*IN_MILLISECONDS); - m_uiShatteringThrowTimer = urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS); - m_uiDisarmTimer = urand(20*IN_MILLISECONDS, 80*IN_MILLISECONDS); - SetEquipmentSlots(false, 47427, 46964, EQUIP_NO_CHANGE); - } + public: + mob_toc_warrior() : CreatureScript("mob_toc_warrior") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_warriorAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; - - if (m_uiBladestormTimer <= uiDiff) - { - DoCastVictim(SPELL_BLADESTORM); - m_uiBladestormTimer = urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiBladestormTimer -= uiDiff; - - if (m_uiIntimidatingShoutTimer <= uiDiff) - { - DoCast(me, SPELL_INTIMIDATING_SHOUT); - m_uiIntimidatingShoutTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS); - } else m_uiIntimidatingShoutTimer -= uiDiff; - - if (m_uiMortalStrikeTimer <= uiDiff) - { - DoCastVictim(SPELL_MORTAL_STRIKE); - m_uiMortalStrikeTimer = urand(6*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiMortalStrikeTimer -= uiDiff; - - if (m_uiSunderArmorTimer <= uiDiff) - { - DoCastVictim(SPELL_SUNDER_ARMOR); - m_uiSunderArmorTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiSunderArmorTimer -= uiDiff; - - if (m_uiChargeTimer <= uiDiff) - { - DoCastVictim(SPELL_CHARGE); - m_uiChargeTimer = urand(3*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiChargeTimer -= uiDiff; + mob_toc_warriorAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_BLADESTORM, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_INTIMIDATING_SHOUT, urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_MORTAL_STRIKE, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_WARR_CHARGE, 1*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_DISARM, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_OVERPOWER, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_SUNDER_ARMOR, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_SHATTERING_THROW, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_RETALIATION, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + SetEquipmentSlots(false, 47427, 46964, EQUIP_NO_CHANGE); + } - if (m_uiRetaliationTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - DoCastVictim(SPELL_RETALIATION); - m_uiRetaliationTimer = urand(30*IN_MILLISECONDS, 60*IN_MILLISECONDS); - } else m_uiRetaliationTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiOverpowerTimer <= uiDiff) - { - DoCastVictim(SPELL_OVERPOWER); - m_uiOverpowerTimer = urand(30*IN_MILLISECONDS, 90*IN_MILLISECONDS); - } else m_uiOverpowerTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiShatteringThrowTimer <= uiDiff) - { - DoCastVictim(SPELL_SHATTERING_THROW); - m_uiShatteringThrowTimer = urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiShatteringThrowTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiDisarmTimer <= uiDiff) - { - DoCastVictim(SPELL_DISARM); - m_uiDisarmTimer = urand(20*IN_MILLISECONDS, 80*IN_MILLISECONDS); - } else m_uiDisarmTimer -= uiDiff; + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_BLADESTORM: + DoCastVictim(SPELL_BLADESTORM); + events.ScheduleEvent(EVENT_BLADESTORM, 150*IN_MILLISECONDS); + return; + case EVENT_INTIMIDATING_SHOUT: + DoCastAOE(SPELL_INTIMIDATING_SHOUT); + events.ScheduleEvent(EVENT_INTIMIDATING_SHOUT, 120*IN_MILLISECONDS); + return; + case EVENT_MORTAL_STRIKE: + DoCastVictim(SPELL_MORTAL_STRIKE); + events.ScheduleEvent(EVENT_MORTAL_STRIKE, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_WARR_CHARGE: + DoCastVictim(SPELL_CHARGE); + events.ScheduleEvent(EVENT_WARR_CHARGE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_DISARM: + DoCastVictim(SPELL_DISARM); + events.ScheduleEvent(EVENT_DISARM, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + return; + case EVENT_OVERPOWER: + DoCastVictim(SPELL_OVERPOWER); + events.ScheduleEvent(EVENT_OVERPOWER, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + return; + case EVENT_SUNDER_ARMOR: + DoCastVictim(SPELL_SUNDER_ARMOR); + events.ScheduleEvent(EVENT_SUNDER_ARMOR, urand(2*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + return; + case EVENT_SHATTERING_THROW: + if (me->getVictim()->HasAuraWithMechanic(1<<MECHANIC_IMMUNE_SHIELD)) + { + DoCastVictim(SPELL_SHATTERING_THROW); + events.RescheduleEvent(EVENT_SHATTERING_THROW, 5*MINUTE*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_SHATTERING_THROW, 3*IN_MILLISECONDS); + return; + case EVENT_RETALIATION: + if (HealthBelowPct(50)) + { + DoCast(SPELL_RETALIATION); + events.RescheduleEvent(EVENT_RETALIATION, 5*MINUTE*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_RETALIATION, 5*IN_MILLISECONDS); + return; + default: + return; + } + } + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_warriorAI (creature); } - }; - -}; - -enum eDeathKnightSpells -{ - SPELL_CHAINS_OF_ICE = 66020, //8sec - SPELL_DEATH_COIL = 66019, //5sec - SPELL_DEATH_GRIP = 66017, //35sec - SPELL_FROST_STRIKE = 66047, //6sec - SPELL_ICEBOUND_FORTITUDE = 66023, //1min - SPELL_ICY_TOUCH = 66021, //8sec - SPELL_STRANGULATE = 66018, //2min }; class mob_toc_dk : public CreatureScript { -public: - mob_toc_dk() : CreatureScript("mob_toc_dk") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_dkAI (creature); - } - - struct mob_toc_dkAI : public boss_faction_championsAI - { - mob_toc_dkAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} - - uint32 m_uiIceboundFortitudeTimer; - uint32 m_uiChainsOfIceTimer; - uint32 m_uiDeathCoilTimer; - uint32 m_uiStrangulateTimer; - uint32 m_uiFrostStrikeTimer; - uint32 m_uiIcyTouchTimer; - uint32 m_uiDeathGripTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiIceboundFortitudeTimer = urand(5*IN_MILLISECONDS, 90*IN_MILLISECONDS); - m_uiChainsOfIceTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiDeathCoilTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiStrangulateTimer = urand(10*IN_MILLISECONDS, 90*IN_MILLISECONDS); - m_uiFrostStrikeTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiIcyTouchTimer = urand(8*IN_MILLISECONDS, 12*IN_MILLISECONDS); - m_uiDeathGripTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - SetEquipmentSlots(false, 47518, 51021, EQUIP_NO_CHANGE); - } + public: + mob_toc_dk() : CreatureScript("mob_toc_dk") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_dkAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; - - if (m_uiIceboundFortitudeTimer <= uiDiff) - { - if (HealthBelowPct(50)) - DoCast(me, SPELL_ICEBOUND_FORTITUDE); - m_uiIceboundFortitudeTimer = urand(5*IN_MILLISECONDS, 90*IN_MILLISECONDS); - } else m_uiIceboundFortitudeTimer -= uiDiff; - - if (m_uiChainsOfIceTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_CHAINS_OF_ICE); - m_uiChainsOfIceTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiChainsOfIceTimer -= uiDiff; - - if (m_uiDeathCoilTimer <= uiDiff) - { - DoCastVictim(SPELL_DEATH_COIL); - m_uiDeathCoilTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiDeathCoilTimer -= uiDiff; + mob_toc_dkAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_CHAINS_OF_ICE, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DEATH_COIL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DEATH_GRIP, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_FROST_STRIKE, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_ICEBOUND_FORTITUDE, urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_ICY_TOUCH, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_STRANGULATE, urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + SetEquipmentSlots(false, 47518, 51021, EQUIP_NO_CHANGE); + } - if (m_uiStrangulateTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (Unit* target = SelectEnemyCaster(false)) - DoCast(target, SPELL_STRANGULATE); - m_uiStrangulateTimer = urand(10*IN_MILLISECONDS, 90*IN_MILLISECONDS); - } else m_uiStrangulateTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiFrostStrikeTimer <= uiDiff) - { - DoCastVictim(SPELL_FROST_STRIKE); - m_uiFrostStrikeTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiFrostStrikeTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiIcyTouchTimer <= uiDiff) - { - DoCastVictim(SPELL_ICY_TOUCH); - m_uiIcyTouchTimer = urand(8*IN_MILLISECONDS, 12*IN_MILLISECONDS); - } else m_uiIcyTouchTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiDeathGripTimer <= uiDiff) - { - if (me->IsInRange(me->getVictim(), 10.0f, 30.0f, false)) - DoCastVictim(SPELL_DEATH_GRIP); - m_uiDeathGripTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiDeathGripTimer -= uiDiff; + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CHAINS_OF_ICE: + DoCastVictim(SPELL_CHAINS_OF_ICE); + events.ScheduleEvent(EVENT_CHAINS_OF_ICE, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_DEATH_COIL: + DoCastVictim(SPELL_DEATH_COIL); + events.ScheduleEvent(EVENT_DEATH_COIL, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_DEATH_GRIP: + if (me->IsInRange(me->getVictim(), 5.0f, 30.0f, false)) + { + DoCast(me->getVictim(), SPELL_DEATH_GRIP); + events.RescheduleEvent(EVENT_DEATH_GRIP, 35*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_DEATH_GRIP, 3*IN_MILLISECONDS); + return; + case EVENT_FROST_STRIKE: + DoCastVictim(SPELL_FROST_STRIKE); + events.ScheduleEvent(EVENT_FROST_STRIKE, urand(6*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + return; + case EVENT_ICEBOUND_FORTITUDE: + if (HealthBelowPct(50)) + { + DoCast(SPELL_ICEBOUND_FORTITUDE); + events.RescheduleEvent(EVENT_ICEBOUND_FORTITUDE, 60*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_ICEBOUND_FORTITUDE, 5*IN_MILLISECONDS); + return; + case EVENT_ICY_TOUCH: + DoCastVictim(SPELL_ICY_TOUCH); + events.ScheduleEvent(EVENT_ICY_TOUCH, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_STRANGULATE: + if (Unit* target = SelectEnemyCaster(false)) + { + DoCast(target, SPELL_STRANGULATE); + events.RescheduleEvent(EVENT_STRANGULATE, 120*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_STRANGULATE, 5*IN_MILLISECONDS); + return; + default: + return; + } + } + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_dkAI (creature); } - }; - -}; - -enum eRogueSpells -{ - SPELL_FAN_OF_KNIVES = 65955, //2sec - SPELL_BLIND = 65960, //2min - SPELL_CLOAK = 65961, //90sec - SPELL_BLADE_FLURRY = 65956, //2min - SPELL_SHADOWSTEP = 66178, //30sec - SPELL_HEMORRHAGE = 65954, - SPELL_EVISCERATE = 65957, }; class mob_toc_rogue : public CreatureScript { -public: - mob_toc_rogue() : CreatureScript("mob_toc_rogue") { } + public: + mob_toc_rogue() : CreatureScript("mob_toc_rogue") { } - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_rogueAI (creature); - } + struct mob_toc_rogueAI : public boss_faction_championsAI + { + mob_toc_rogueAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_FAN_OF_KNIVES, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_BLIND, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_CLOAK, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_BLADE_FLURRY, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_SHADOWSTEP, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HEMORRHAGE, urand(3*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_EVISCERATE, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_WOUND_POISON, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + SetEquipmentSlots(false, 47422, 49982, EQUIP_NO_CHANGE); + me->setPowerType(POWER_ENERGY); + me->SetMaxPower(POWER_ENERGY, 100); + } - struct mob_toc_rogueAI : public boss_faction_championsAI - { - mob_toc_rogueAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - uint32 m_uiFanOfKnivesTimer; - uint32 m_uiHemorrhageTimer; - uint32 m_uiEviscerateTimer; - uint32 m_uiShadowstepTimer; - uint32 m_uiBlindTimer; - uint32 m_uiCloakTimer; - uint32 m_uiBladeFlurryTimer; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FAN_OF_KNIVES: + if (EnemiesInRange(10.0f) >= 2) + DoCastAOE(SPELL_FAN_OF_KNIVES); + events.ScheduleEvent(EVENT_FAN_OF_KNIVES, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_BLIND: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + DoCast(target, SPELL_BLIND); + events.ScheduleEvent(EVENT_BLIND, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_CLOAK: + if (HealthBelowPct(50)) + { + DoCast(SPELL_CLOAK); + events.RescheduleEvent(EVENT_CLOAK, 90*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_CLOAK, 5*IN_MILLISECONDS); + return; + case EVENT_BLADE_FLURRY: + if (EnemiesInRange(10.0f) >= 2) + { + DoCast(SPELL_BLADE_FLURRY); + events.RescheduleEvent(EVENT_BLADE_FLURRY, 120*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_BLADE_FLURRY, 5*IN_MILLISECONDS); + return; + case EVENT_SHADOWSTEP: + if (me->IsInRange(me->getVictim(), 10.0f, 40.0f, false)) + { + DoCast(me->getVictim(), SPELL_SHADOWSTEP); + events.RescheduleEvent(EVENT_SHADOWSTEP, 30*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_SHADOWSTEP, 5*IN_MILLISECONDS); + return; + case EVENT_HEMORRHAGE: + DoCastVictim(SPELL_HEMORRHAGE); + events.ScheduleEvent(EVENT_HEMORRHAGE, urand(3*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + return; + case EVENT_EVISCERATE: + DoCastVictim(SPELL_EVISCERATE); + events.ScheduleEvent(EVENT_EVISCERATE, urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + return; + case EVENT_WOUND_POISON: + DoCastVictim(SPELL_WOUND_POISON); + events.ScheduleEvent(EVENT_WOUND_POISON, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + default: + return; + } + } + } + }; - void Reset() + CreatureAI* GetAI(Creature* creature) const { - boss_faction_championsAI::Reset(); - m_uiFanOfKnivesTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - m_uiHemorrhageTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS); - m_uiEviscerateTimer = urand(15*IN_MILLISECONDS, 20*IN_MILLISECONDS); - m_uiShadowstepTimer = urand(10*IN_MILLISECONDS, 80*IN_MILLISECONDS); - m_uiBlindTimer = urand(7*IN_MILLISECONDS, 8*IN_MILLISECONDS); - m_uiCloakTimer = urand(20*IN_MILLISECONDS, 120*IN_MILLISECONDS); - m_uiBladeFlurryTimer = urand(12*IN_MILLISECONDS, 120*IN_MILLISECONDS); - SetEquipmentSlots(false, 47422, 49982, EQUIP_NO_CHANGE); + return new mob_toc_rogueAI (creature); } +}; + +class mob_toc_enh_shaman : public CreatureScript +{ + public: + mob_toc_enh_shaman() : CreatureScript("mob_toc_enh_shaman") { } - void UpdateAI(const uint32 uiDiff) + struct mob_toc_enh_shamanAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; + mob_toc_enh_shamanAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_DPS_EARTH_SHOCK, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_LAVA_LASH, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_STORMSTRIKE, urand(2*IN_MILLISECONDS, 5*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DPS_BLOODLUST_HEROISM, 20*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_DEPLOY_TOTEM, 1*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_WINDFURY, urand(20*IN_MILLISECONDS, 50*IN_MILLISECONDS)); + + _totemCount = 0; + _totemOldCenterX = me->GetPositionX(); + _totemOldCenterY = me->GetPositionY(); + SetEquipmentSlots(false, 51803, 48013, EQUIP_NO_CHANGE); + summons.DespawnAll(); + } - if (m_uiFanOfKnivesTimer <= uiDiff) + void JustSummoned(Creature* summoned) { - if (EnemiesInRange(15.0f) > 2) - DoCastAOE(SPELL_FAN_OF_KNIVES); - m_uiFanOfKnivesTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - } else m_uiFanOfKnivesTimer -= uiDiff; + summons.Summon(summoned); + } - if (m_uiHemorrhageTimer <= uiDiff) + void SummonedCreatureDespawn(Creature* /*pSummoned*/) { - DoCastVictim(SPELL_HEMORRHAGE); - m_uiHemorrhageTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS); - } else m_uiHemorrhageTimer -= uiDiff; + --_totemCount; + } - if (m_uiEviscerateTimer <= uiDiff) + void DeployTotem() { - DoCastVictim(SPELL_EVISCERATE); - m_uiEviscerateTimer = urand(15*IN_MILLISECONDS, 20*IN_MILLISECONDS); - } else m_uiEviscerateTimer -= uiDiff; + _totemCount = 4; + _totemOldCenterX = me->GetPositionX(); + _totemOldCenterY = me->GetPositionY(); + /* + -Windfury (16% melee haste) + -Grounding (redirects one harmful magic spell to the totem) - if (m_uiShadowstepTimer <= uiDiff) - { - if (me->IsInRange(me->getVictim(), 10.0f, 40.0f)) - DoCastVictim(SPELL_SHADOWSTEP); - m_uiShadowstepTimer = urand(10*IN_MILLISECONDS, 80*IN_MILLISECONDS); - } else m_uiShadowstepTimer -= uiDiff; + -Healing Stream (unable to find amount of healing in our logs) - if (m_uiBlindTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - if (me->IsInRange(target, 0.0f, 15.0f, false)) - DoCast(target, SPELL_BLIND); - m_uiBlindTimer = urand(7*IN_MILLISECONDS, 8*IN_MILLISECONDS); - } else m_uiBlindTimer -= uiDiff; + -Tremor (prevents fear effects) + -Strength of Earth (155 strength and agil for the opposing team) - if (m_uiCloakTimer <= uiDiff) - { - if (HealthBelowPct(50)) - DoCast(me, SPELL_CLOAK); - m_uiCloakTimer = urand(20*IN_MILLISECONDS, 120*IN_MILLISECONDS); - } else m_uiCloakTimer -= uiDiff; + -Searing (average ~3500 damage on a random target every ~3.5 seconds) + */ + } - if (m_uiBladeFlurryTimer <= uiDiff) + void JustDied(Unit* killer) { - DoCastVictim(SPELL_BLADE_FLURRY); - m_uiBladeFlurryTimer = urand(12*IN_MILLISECONDS, 120*IN_MILLISECONDS); - } else m_uiBladeFlurryTimer -= uiDiff; - - boss_faction_championsAI::UpdateAI(uiDiff); - } - }; - -}; - -enum eEnhShamanSpells -{ - SPELL_EARTH_SHOCK_ENH = 65973, - SPELL_LAVA_LASH = 65974, - SPELL_STORMSTRIKE = 65970, -}; - -class mob_toc_enh_shaman : public CreatureScript -{ -public: - mob_toc_enh_shaman() : CreatureScript("mob_toc_enh_shaman") { } + boss_faction_championsAI::JustDied(killer); + summons.DespawnAll(); + } - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_enh_shamanAI (creature); - } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - struct mob_toc_enh_shamanAI : public boss_faction_championsAI - { - mob_toc_enh_shamanAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE), Summons(me) {} + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - SummonList Summons; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - uint32 m_uiHeroismOrBloodlustTimer; - uint32 m_uiEarthShockTimer; - uint32 m_uiStormstrikeTimer; - uint32 m_uiLavaLashTimer; - uint32 m_uiDeployTotemTimer; - uint8 m_uiTotemCount; - float m_fTotemOldCenterX, m_fTotemOldCenterY; + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DPS_EARTH_SHOCK: + if (Unit* target = SelectEnemyCaster(true)) + DoCast(target, SPELL_EARTH_SHOCK); + events.ScheduleEvent(EVENT_DPS_EARTH_SHOCK, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_LAVA_LASH: + DoCastVictim(SPELL_LAVA_LASH); + events.ScheduleEvent(EVENT_LAVA_LASH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_STORMSTRIKE: + DoCastVictim(SPELL_STORMSTRIKE); + events.ScheduleEvent(EVENT_STORMSTRIKE, urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + return; + case EVENT_DPS_BLOODLUST_HEROISM: + if (me->getFaction()) //Am i alliance? + { + if (!me->HasAura(AURA_EXHAUSTION)) + DoCastAOE(SPELL_HEROISM); + } + else + { + if (!me->HasAura(AURA_SATED)) + DoCastAOE(SPELL_BLOODLUST); + } + events.ScheduleEvent(EVENT_DPS_BLOODLUST_HEROISM, 5*MINUTE*IN_MILLISECONDS); + return; + case EVENT_DEPLOY_TOTEM: + if (_totemCount < 4 || me->GetDistance2d(_totemOldCenterX, _totemOldCenterY) > 20.0f) + DeployTotem(); + events.ScheduleEvent(EVENT_DEPLOY_TOTEM, 1*IN_MILLISECONDS); + return; + case EVENT_WINDFURY: + DoCastVictim(SPELL_WINDFURY); + events.ScheduleEvent(EVENT_WINDFURY, urand(20*IN_MILLISECONDS, 60*IN_MILLISECONDS)); + return; + default: + return; + } + } + } + private: + uint8 _totemCount; + float _totemOldCenterX, _totemOldCenterY; + }; - void Reset() + CreatureAI* GetAI(Creature* creature) const { - boss_faction_championsAI::Reset(); - m_uiHeroismOrBloodlustTimer = urand(25*IN_MILLISECONDS, 60*IN_MILLISECONDS); - m_uiEarthShockTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS); - m_uiStormstrikeTimer = urand(5*IN_MILLISECONDS, 90*IN_MILLISECONDS); - m_uiLavaLashTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS); - m_uiDeployTotemTimer = urand(1*IN_MILLISECONDS, 3*IN_MILLISECONDS); - m_uiTotemCount = 0; - m_fTotemOldCenterX = me->GetPositionX(); - m_fTotemOldCenterY = me->GetPositionY(); - SetEquipmentSlots(false, 51803, 48013, EQUIP_NO_CHANGE); - Summons.DespawnAll(); + return new mob_toc_enh_shamanAI (creature); } +}; - void JustSummoned(Creature* summoned) - { - Summons.Summon(summoned); - } +class mob_toc_retro_paladin : public CreatureScript +{ + public: + mob_toc_retro_paladin() : CreatureScript("mob_toc_retro_paladin") { } - void SummonedCreatureDespawn(Creature* /*pSummoned*/) + struct mob_toc_retro_paladinAI : public boss_faction_championsAI { - --m_uiTotemCount; - } + mob_toc_retro_paladinAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} + + void Reset() + { + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_AVENGING_WRATH, urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_CRUSADER_STRIKE, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DIVINE_STORM, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_HAMMER_OF_JUSTICE_RET, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_JUDGEMENT_OF_COMMAND, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_REPENTANCE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DPS_HAND_OF_PROTECTION, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_DPS_DIVINE_SHIELD, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + SetEquipmentSlots(false, 47519, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + } - void DeployTotem() - { - m_uiTotemCount = 4; - m_fTotemOldCenterX = me->GetPositionX(); - m_fTotemOldCenterY = me->GetPositionY(); - /* - -Windfury (16% melee haste) - -Grounding (redirects one harmful magic spell to the totem) + void EnterCombat(Unit* who) + { + boss_faction_championsAI::EnterCombat(who); + DoCast(SPELL_SEAL_OF_COMMAND); + } - -Healing Stream (unable to find amount of healing in our logs) + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - -Tremor (prevents fear effects) - -Strength of Earth (155 strength and agil for the opposing team) + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - -Searing (average ~3500 damage on a random target every ~3.5 seconds) - */ - } + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_AVENGING_WRATH: + DoCast(SPELL_AVENGING_WRATH); + events.ScheduleEvent(EVENT_AVENGING_WRATH, 180*IN_MILLISECONDS); + return; + case EVENT_CRUSADER_STRIKE: + DoCastVictim(SPELL_CRUSADER_STRIKE); + events.ScheduleEvent(EVENT_CRUSADER_STRIKE, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_DIVINE_STORM: + if (EnemiesInRange(10.0f) >= 2) + DoCast(SPELL_DIVINE_STORM); + events.ScheduleEvent(EVENT_DIVINE_STORM, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS)); + return; + case EVENT_HAMMER_OF_JUSTICE_RET: + DoCastVictim(SPELL_HAMMER_OF_JUSTICE_RET); + events.ScheduleEvent(EVENT_HAMMER_OF_JUSTICE_RET, 40*IN_MILLISECONDS); + return; + case EVENT_JUDGEMENT_OF_COMMAND: + DoCastVictim(SPELL_JUDGEMENT_OF_COMMAND); + events.ScheduleEvent(EVENT_JUDGEMENT_OF_COMMAND, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_REPENTANCE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + DoCast(target, SPELL_REPENTANCE); + events.ScheduleEvent(EVENT_REPENTANCE, 60*IN_MILLISECONDS); + return; + case EVENT_DPS_HAND_OF_PROTECTION: + if (Unit* target = DoSelectLowestHpFriendly(30.0f)) + { + if (!target->HasAura(SPELL_FORBEARANCE)) + { + DoCast(target, SPELL_HAND_OF_PROTECTION); + events.RescheduleEvent(EVENT_DPS_HAND_OF_PROTECTION, 5*MINUTE*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_DPS_HAND_OF_PROTECTION, 5*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_DPS_HAND_OF_PROTECTION, 5*IN_MILLISECONDS); + return; + case EVENT_DPS_DIVINE_SHIELD: + if (HealthBelowPct(30) && !me->HasAura(SPELL_FORBEARANCE)) + { + DoCast(me, SPELL_DIVINE_SHIELD); + events.RescheduleEvent(EVENT_DPS_DIVINE_SHIELD, 5*MINUTE*IN_MILLISECONDS); + } + else + events.RescheduleEvent(EVENT_DPS_DIVINE_SHIELD, 5*IN_MILLISECONDS); + return; + default: + return; + } + } + } + }; - void JustDied(Unit* killer) + CreatureAI* GetAI(Creature* creature) const { - boss_faction_championsAI::JustDied(killer); - Summons.DespawnAll(); + return new mob_toc_retro_paladinAI (creature); } +}; - void UpdateAI(const uint32 uiDiff) +class mob_toc_pet_warlock : public CreatureScript +{ + public: + mob_toc_pet_warlock() : CreatureScript("mob_toc_pet_warlock") { } + + struct mob_toc_pet_warlockAI : public boss_faction_championsAI { - if (!UpdateVictim()) - return; + mob_toc_pet_warlockAI(Creature* creature) : boss_faction_championsAI(creature, AI_PET) {} - if (m_uiHeroismOrBloodlustTimer <= uiDiff) + void Reset() { - if (me->getFaction()) //Am i alliance? - { - if (!me->HasAura(AURA_EXHAUSTION)) - DoCastAOE(SPELL_HEROISM); - } - else - if (!me->HasAura(AURA_SATED)) - DoCastAOE(SPELL_BLOODLUST); - m_uiHeroismOrBloodlustTimer = urand(25*IN_MILLISECONDS, 60*IN_MILLISECONDS); - } else m_uiHeroismOrBloodlustTimer -= uiDiff; + boss_faction_championsAI::Reset(); + events.ScheduleEvent(EVENT_DEVOUR_MAGIC, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_SPELL_LOCK, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + } - if (m_uiEarthShockTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - DoCastVictim(SPELL_EARTH_SHOCK_ENH); - m_uiEarthShockTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS); - } else m_uiEarthShockTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiStormstrikeTimer <= uiDiff) - { - DoCastVictim(SPELL_STORMSTRIKE); - m_uiStormstrikeTimer = urand(5*IN_MILLISECONDS, 90*IN_MILLISECONDS); - } else m_uiStormstrikeTimer -= uiDiff; + events.Update(diff); + boss_faction_championsAI::UpdateAI(diff); - if (m_uiLavaLashTimer <= uiDiff) - { - DoCastVictim(SPELL_LAVA_LASH); - m_uiLavaLashTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS); - } else m_uiLavaLashTimer -= uiDiff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (m_uiDeployTotemTimer <= uiDiff) - { - if (m_uiTotemCount < 4 || me->GetDistance2d(m_fTotemOldCenterX, m_fTotemOldCenterY) > 20.0f) - DeployTotem(); - m_uiDeployTotemTimer = urand(1*IN_MILLISECONDS, 3*IN_MILLISECONDS); - } else m_uiDeployTotemTimer -= uiDiff; + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DEVOUR_MAGIC: + DoCastVictim(SPELL_DEVOUR_MAGIC); + events.ScheduleEvent(EVENT_DEVOUR_MAGIC, urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + return; + case EVENT_SPELL_LOCK: + DoCast(SPELL_SPELL_LOCK); + events.ScheduleEvent(EVENT_SPELL_LOCK, urand(24*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + default: + return; + } + } + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_toc_pet_warlockAI (creature); } - }; - }; -enum eRetroPaladinSpells +class mob_toc_pet_hunter : public CreatureScript { - SPELL_AVENGING_WRATH = 66011, //3min cd - SPELL_CRUSADER_STRIKE = 66003, //6sec cd - SPELL_DIVINE_SHIELD = 66010, //5min cd - SPELL_DIVINE_STORM = 66006, //10sec cd - SPELL_HAMMER_OF_JUSTICE_RET = 66007, //40sec cd - SPELL_HAND_OF_PROTECTION_RET = 66009, //5min cd - SPELL_JUDGEMENT_OF_COMMAND = 66005, //8sec cd - SPELL_REPENTANCE = 66008, //60sec cd - SPELL_SEAL_OF_COMMAND = 66004, //no cd -}; + public: + mob_toc_pet_hunter() : CreatureScript("mob_toc_pet_hunter") { } -class mob_toc_retro_paladin : public CreatureScript -{ -public: - mob_toc_retro_paladin() : CreatureScript("mob_toc_retro_paladin") { } + struct mob_toc_pet_hunterAI : public boss_faction_championsAI + { + mob_toc_pet_hunterAI(Creature* creature) : boss_faction_championsAI(creature, AI_PET) {} - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_retro_paladinAI (creature); - } + void Reset() + { + boss_faction_championsAI::Reset(); + _clawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS); + } - struct mob_toc_retro_paladinAI : public boss_faction_championsAI - { - mob_toc_retro_paladinAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {} + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - uint32 m_uiRepeteanceTimer; - uint32 m_uiCrusaderStrikeTimer; - uint32 m_uiAvengingWrathTimer; - uint32 m_uiDivineShieldTimer; - uint32 m_uiDivineStormTimer; - uint32 m_uiJudgementOfCommandTimer; + boss_faction_championsAI::UpdateAI(diff); - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiRepeteanceTimer = 60*IN_MILLISECONDS; - m_uiCrusaderStrikeTimer = urand(6*IN_MILLISECONDS, 18*IN_MILLISECONDS); - m_uiAvengingWrathTimer = 180*IN_MILLISECONDS; - m_uiDivineShieldTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS); - m_uiDivineStormTimer = 10*IN_MILLISECONDS; - m_uiJudgementOfCommandTimer = urand(8*IN_MILLISECONDS, 15*IN_MILLISECONDS); - SetEquipmentSlots(false, 47519, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - } + if (_clawTimer <= diff) + { + DoCastVictim(SPELL_CLAW); + _clawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS); + } + else + _clawTimer -= diff; + } + private: + uint32 _clawTimer; + }; - void EnterCombat(Unit* who) + CreatureAI* GetAI(Creature* creature) const { - boss_faction_championsAI::EnterCombat(who); - DoCast(SPELL_SEAL_OF_COMMAND); + return new mob_toc_pet_hunterAI (creature); } +}; - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - if (m_uiRepeteanceTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_REPENTANCE); - m_uiRepeteanceTimer = 60*IN_MILLISECONDS; - } else m_uiRepeteanceTimer -= uiDiff; - - if (m_uiCrusaderStrikeTimer <= uiDiff) - { - DoCastVictim(SPELL_CRUSADER_STRIKE); - m_uiCrusaderStrikeTimer = urand(6*IN_MILLISECONDS, 18*IN_MILLISECONDS); - } else m_uiCrusaderStrikeTimer -= uiDiff; +class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader +{ + public: + spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { } - if (m_uiAvengingWrathTimer <= uiDiff) - { - DoCastVictim(SPELL_AVENGING_WRATH); - m_uiAvengingWrathTimer = 180*IN_MILLISECONDS; - } else m_uiAvengingWrathTimer -= uiDiff; + class spell_faction_champion_warl_unstable_affliction_AuraScript : public AuraScript + { + PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_AuraScript); - if (m_uiDivineShieldTimer <= uiDiff) + bool Validate(SpellInfo const* /*spell*/) { - if (HealthBelowPct(20)) - DoCast(me, SPELL_DIVINE_SHIELD); - m_uiDivineShieldTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS); - } else m_uiDivineShieldTimer -= uiDiff; + if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL)) + return false; + return true; + } - if (m_uiDivineStormTimer <= uiDiff) + void HandleDispel(DispelInfo* dispelInfo) { - DoCastVictim(SPELL_DIVINE_STORM); - m_uiDivineStormTimer = 10*IN_MILLISECONDS; - } else m_uiDivineStormTimer -= uiDiff; + if (Unit* caster = GetCaster()) + caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, NULL, GetEffect(EFFECT_0)); + } - if (m_uiJudgementOfCommandTimer <= uiDiff) + void Register() { - DoCastVictim(SPELL_JUDGEMENT_OF_COMMAND); - m_uiJudgementOfCommandTimer = urand(8*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiJudgementOfCommandTimer -= uiDiff; + AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_AuraScript::HandleDispel); + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + AuraScript* GetAuraScript() const + { + return new spell_faction_champion_warl_unstable_affliction_AuraScript(); } - }; - -}; - -enum eWarlockPetSpells -{ - SPELL_DEVOUR_MAGIC = 67518, - SPELL_SPELL_LOCK = 67519, }; -class mob_toc_pet_warlock : public CreatureScript +class spell_faction_champion_death_grip : public SpellScriptLoader { -public: - mob_toc_pet_warlock() : CreatureScript("mob_toc_pet_warlock") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_pet_warlockAI (creature); - } - - struct mob_toc_pet_warlockAI : public boss_faction_championsAI - { - mob_toc_pet_warlockAI(Creature* creature) : boss_faction_championsAI(creature, AI_PET) {} - - uint32 m_uiDevourMagicTimer; - uint32 m_uiSpellLockTimer; - - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiDevourMagicTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - m_uiSpellLockTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } + public: + spell_faction_champion_death_grip() : SpellScriptLoader("spell_faction_champion_death_grip") { } - void UpdateAI(const uint32 uiDiff) + class spell_faction_champion_death_grip_SpellScript : public SpellScript { - if (!UpdateVictim()) - return; + PrepareSpellScript(spell_faction_champion_death_grip_SpellScript); - if (m_uiDevourMagicTimer <= uiDiff) + bool Validate(SpellInfo const* /*spell*/) { - DoCastVictim(SPELL_DEVOUR_MAGIC); - m_uiDevourMagicTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiDevourMagicTimer -= uiDiff; + if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_GRIP_PULL)) + return false; + return true; + } - if (m_uiSpellLockTimer <= uiDiff) + void HandleDummy(SpellEffIndex /*effIndex*/) { - DoCastVictim(SPELL_SPELL_LOCK); - m_uiSpellLockTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiSpellLockTimer -= uiDiff; + if (Unit* target = GetHitUnit()) + { + if (Unit* caster = GetCaster()) + target->CastSpell(caster, SPELL_DEATH_GRIP_PULL); + } + } - boss_faction_championsAI::UpdateAI(uiDiff); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_faction_champion_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } -}; + }; -enum eHunterPetSpells -{ - SPELL_CLAW = 67793, + SpellScript* GetSpellScript() const + { + return new spell_faction_champion_death_grip_SpellScript(); + } }; -class mob_toc_pet_hunter : public CreatureScript +class spell_toc_bloodlust : public SpellScriptLoader { -public: - mob_toc_pet_hunter() : CreatureScript("mob_toc_pet_hunter") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_toc_pet_hunterAI (creature); - } + public: + spell_toc_bloodlust() : SpellScriptLoader("spell_toc_bloodlust") { } - struct mob_toc_pet_hunterAI : public boss_faction_championsAI - { - mob_toc_pet_hunterAI(Creature* creature) : boss_faction_championsAI(creature, AI_PET) {} + class spell_toc_bloodlust_SpellScript : public SpellScript + { + PrepareSpellScript(spell_toc_bloodlust_SpellScript); - uint32 m_uiClawTimer; + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(AURA_SATED)) + return false; + return true; + } - void Reset() - { - boss_faction_championsAI::Reset(); - m_uiClawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS); - } + void RemoveInvalidTargets(std::list<WorldObject*>& targets) + { + targets.remove_if(Trinity::UnitAuraCheck(true, AURA_SATED)); + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void ApplyDebuff() + { + if (Unit* target = GetHitUnit()) + target->CastSpell(target, AURA_SATED, true); + } - if (m_uiClawTimer <= uiDiff) + void Register() { - DoCastVictim(SPELL_CLAW); - m_uiClawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS); - } else m_uiClawTimer -= uiDiff; + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY); + AfterHit += SpellHitFn(spell_toc_bloodlust_SpellScript::ApplyDebuff); + } + }; - boss_faction_championsAI::UpdateAI(uiDiff); + SpellScript* GetSpellScript() const + { + return new spell_toc_bloodlust_SpellScript(); } - }; }; -class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader +class spell_toc_heroism : public SpellScriptLoader { public: - spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { } + spell_toc_heroism() : SpellScriptLoader("spell_toc_heroism") { } - class spell_faction_champion_warl_unstable_affliction_AuraScript : public AuraScript + class spell_toc_heroism_SpellScript : public SpellScript { - PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_AuraScript); + PrepareSpellScript(spell_toc_heroism_SpellScript); - bool Validate(SpellInfo const* /*spell*/) + bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL)) + if (!sSpellMgr->GetSpellInfo(AURA_EXHAUSTION)) return false; return true; } - void HandleDispel(DispelInfo* dispelInfo) + void RemoveInvalidTargets(std::list<WorldObject*>& targets) { - if (Unit* caster = GetCaster()) - caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, NULL, GetEffect(EFFECT_0)); + targets.remove_if(Trinity::UnitAuraCheck(true, AURA_EXHAUSTION)); + } + + void ApplyDebuff() + { + if (Unit* target = GetHitUnit()) + target->CastSpell(target, AURA_EXHAUSTION, true); } void Register() { - AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_AuraScript::HandleDispel); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY); + AfterHit += SpellHitFn(spell_toc_heroism_SpellScript::ApplyDebuff); } }; - AuraScript* GetAuraScript() const + SpellScript* GetSpellScript() const { - return new spell_faction_champion_warl_unstable_affliction_AuraScript(); + return new spell_toc_heroism_SpellScript(); } }; @@ -2086,5 +2392,9 @@ void AddSC_boss_faction_champions() new mob_toc_retro_paladin(); new mob_toc_pet_warlock(); new mob_toc_pet_hunter(); + new spell_faction_champion_warl_unstable_affliction(); + new spell_faction_champion_death_grip(); + new spell_toc_bloodlust(); + new spell_toc_heroism(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 87e7801566e..f8017980766 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -16,23 +16,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: trial_of_the_crusader -SD%Complete: ??% -SDComment: based on /dev/rsa -SDCategory: Crusader Coliseum -EndScriptData */ - -// Known bugs: -// Some visuals aren't appearing right sometimes -// -// TODO: -// Redone summon's scripts in SAI -// Add immunities to the boss and summons - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "trial_of_the_crusader.h" +#include "SpellScript.h" enum Yells { @@ -47,15 +34,7 @@ enum Yells SAY_INFERNAL_ERUPTION = 8, SAY_KILL_PLAYER = 9, SAY_DEATH = 10, - SAY_BERSERK = 11, -}; - -enum Equipment -{ - EQUIP_MAIN = 47266, - EQUIP_OFFHAND = 46996, - EQUIP_RANGED = 47267, - EQUIP_DONE = EQUIP_NO_CHANGE, + SAY_BERSERK = 11 }; enum Summons @@ -64,7 +43,7 @@ enum Summons NPC_INFERNAL_VOLCANO = 34813, NPC_FEL_INFERNAL = 34815, // immune to all CC on Heroic (stuns, banish, interrupt, etc) NPC_NETHER_PORTAL = 34825, - NPC_MISTRESS_OF_PAIN = 34826, + NPC_MISTRESS_OF_PAIN = 34826 }; enum BossSpells @@ -84,442 +63,530 @@ enum BossSpells SPELL_BERSERK = 64238, // unused // Mistress of Pain spells - SPELL_SHIVAN_SLASH = 67098, - SPELL_SPINNING_STRIKE = 66283, - SPELL_MISTRESS_KISS = 67077, - SPELL_FEL_INFERNO = 67047, - SPELL_FEL_STREAK = 66494, + SPELL_SHIVAN_SLASH = 67098, + SPELL_SPINNING_STRIKE = 66283, + SPELL_MISTRESS_KISS = 66336, + SPELL_FEL_INFERNO = 67047, + SPELL_FEL_STREAK = 66494, + SPELL_LORD_HITTIN = 66326, // special effect preventing more specific spells be cast on the same player within 10 seconds + SPELL_MISTRESS_KISS_DEBUFF = 66334, + SPELL_MISTRESS_KISS_DAMAGE_SILENCE = 66359 }; -/*###### -## boss_jaraxxus -######*/ +enum Events +{ + // Lord Jaraxxus + EVENT_FEL_FIREBALL = 1, + EVENT_FEL_LIGHTNING = 2, + EVENT_INCINERATE_FLESH = 3, + EVENT_NETHER_POWER = 4, + EVENT_LEGION_FLAME = 5, + EVENT_SUMMONO_NETHER_PORTAL = 6, + EVENT_SUMMON_INFERNAL_ERUPTION = 7, + + // Mistress of Pain + EVENT_SHIVAN_SLASH = 8, + EVENT_SPINNING_STRIKE = 9, + EVENT_MISTRESS_KISS = 10 +}; class boss_jaraxxus : public CreatureScript { -public: - boss_jaraxxus() : CreatureScript("boss_jaraxxus") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new boss_jaraxxusAI(creature); - } - - struct boss_jaraxxusAI : public ScriptedAI - { - boss_jaraxxusAI(Creature* creature) : ScriptedAI(creature), Summons(me) - { - instance = creature->GetInstanceScript(); - Reset(); - } - - InstanceScript* instance; + public: + boss_jaraxxus() : CreatureScript("boss_jaraxxus") { } - SummonList Summons; - - uint32 m_uiFelFireballTimer; - uint32 m_uiFelLightningTimer; - uint32 m_uiIncinerateFleshTimer; - uint32 m_uiNetherPowerTimer; - uint32 m_uiLegionFlameTimer; - uint32 m_uiSummonNetherPortalTimer; - uint32 m_uiSummonInfernalEruptionTimer; - - void Reset() + struct boss_jaraxxusAI : public BossAI { - if (instance) - instance->SetData(TYPE_JARAXXUS, NOT_STARTED); - SetEquipmentSlots(false, EQUIP_MAIN, EQUIP_OFFHAND, EQUIP_RANGED); - m_uiFelFireballTimer = 5*IN_MILLISECONDS; - m_uiFelLightningTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); - m_uiNetherPowerTimer = 40*IN_MILLISECONDS; - m_uiLegionFlameTimer = 30*IN_MILLISECONDS; - m_uiSummonNetherPortalTimer = 1*MINUTE*IN_MILLISECONDS; - m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS; - Summons.DespawnAll(); - } + boss_jaraxxusAI(Creature* creature) : BossAI(creature, BOSS_JARAXXUS) + { + } - void JustReachedHome() - { - if (instance) - instance->SetData(TYPE_JARAXXUS, FAIL); - DoCast(me, SPELL_JARAXXUS_CHAINS); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - } + void Reset() + { + _Reset(); + events.ScheduleEvent(EVENT_FEL_FIREBALL, 5*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_FEL_LIGHTNING, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_INCINERATE_FLESH, urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_NETHER_POWER, 40*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_LEGION_FLAME, 30*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUMMONO_NETHER_PORTAL, 20*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUMMON_INFERNAL_ERUPTION, 80*IN_MILLISECONDS); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) + void JustReachedHome() { + _JustReachedHome(); if (instance) - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + instance->SetBossState(BOSS_JARAXXUS, FAIL); + DoCast(me, SPELL_JARAXXUS_CHAINS); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - } - void JustDied(Unit* /*killer*/) - { - Summons.DespawnAll(); - Talk(SAY_DEATH); - if (instance) - instance->SetData(TYPE_JARAXXUS, DONE); - } - - void JustSummoned(Creature* summoned) - { - Summons.Summon(summoned); - } - - void EnterCombat(Unit* /*who*/) - { - me->SetInCombatWithZone(); - if (instance) - instance->SetData(TYPE_JARAXXUS, IN_PROGRESS); - Talk(SAY_AGGRO); - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - if (m_uiSummonInfernalEruptionTimer <= uiDiff) + void KilledUnit(Unit* who) { - Talk(EMOTE_INFERNAL_ERUPTION); - Talk(SAY_INFERNAL_ERUPTION); - DoCast(SPELL_INFERNAL_ERUPTION); - m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS; - } else m_uiSummonInfernalEruptionTimer -= uiDiff; + if (who->GetTypeId() == TYPEID_PLAYER) + { + Talk(SAY_KILL_PLAYER); + if (instance) + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + } + } - if (m_uiSummonNetherPortalTimer <= uiDiff) + void JustDied(Unit* /*killer*/) { - Talk(EMOTE_NETHER_PORTAL); - Talk(SAY_MISTRESS_OF_PAIN); - DoCast(SPELL_NETHER_PORTAL); - m_uiSummonNetherPortalTimer = 2*MINUTE*IN_MILLISECONDS; - } else m_uiSummonNetherPortalTimer -= uiDiff; + _JustDied(); + Talk(SAY_DEATH); + } - if (m_uiFelFireballTimer <= uiDiff) + void JustSummoned(Creature* summoned) { - DoCastVictim(SPELL_FEL_FIREBALL); - m_uiFelFireballTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiFelFireballTimer -= uiDiff; + summons.Summon(summoned); + } - if (m_uiFelLightningTimer <= uiDiff) + void EnterCombat(Unit* /*who*/) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(target, SPELL_FEL_LIGHTING); - m_uiFelLightningTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiFelLightningTimer -= uiDiff; + _EnterCombat(); + Talk(SAY_AGGRO); + } - if (m_uiIncinerateFleshTimer <= uiDiff) + void UpdateAI(const uint32 diff) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true)) - { - Talk(EMOTE_INCINERATE, target->GetGUID()); - Talk(SAY_INCINERATE); - DoCast(target, SPELL_INCINERATE_FLESH); - } - m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiIncinerateFleshTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (m_uiNetherPowerTimer <= uiDiff) - { - me->CastCustomSpell(SPELL_NETHER_POWER, SPELLVALUE_AURA_STACK, RAID_MODE<uint32>(5, 10, 5,10), me, true); - m_uiNetherPowerTimer = 40*IN_MILLISECONDS; - } else m_uiNetherPowerTimer -= uiDiff; + events.Update(diff); - if (m_uiLegionFlameTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true)) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - Talk(EMOTE_LEGION_FLAME, target->GetGUID()); - DoCast(target, SPELL_LEGION_FLAME); + switch (eventId) + { + case EVENT_FEL_FIREBALL: + DoCastVictim(SPELL_FEL_FIREBALL); + events.ScheduleEvent(EVENT_FEL_FIREBALL, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_FEL_LIGHTNING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_LORD_HITTIN)) + DoCast(target, SPELL_FEL_LIGHTING); + events.ScheduleEvent(EVENT_FEL_LIGHTNING, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS)); + return; + case EVENT_INCINERATE_FLESH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_LORD_HITTIN)) + { + Talk(EMOTE_INCINERATE, target->GetGUID()); + Talk(SAY_INCINERATE); + DoCast(target, SPELL_INCINERATE_FLESH); + } + events.ScheduleEvent(EVENT_INCINERATE_FLESH, urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + return; + case EVENT_NETHER_POWER: + me->CastCustomSpell(SPELL_NETHER_POWER, SPELLVALUE_AURA_STACK, RAID_MODE<uint32>(5, 10, 5,10), me, true); + events.ScheduleEvent(EVENT_NETHER_POWER, 40*IN_MILLISECONDS); + return; + case EVENT_LEGION_FLAME: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_LORD_HITTIN)) + { + Talk(EMOTE_LEGION_FLAME, target->GetGUID()); + DoCast(target, SPELL_LEGION_FLAME); + } + events.ScheduleEvent(EVENT_LEGION_FLAME, 30*IN_MILLISECONDS); + return; + case EVENT_SUMMONO_NETHER_PORTAL: + Talk(EMOTE_NETHER_PORTAL); + Talk(SAY_MISTRESS_OF_PAIN); + DoCast(SPELL_NETHER_PORTAL); + events.ScheduleEvent(EVENT_SUMMONO_NETHER_PORTAL, 2*MINUTE*IN_MILLISECONDS); + return; + case EVENT_SUMMON_INFERNAL_ERUPTION: + Talk(EMOTE_INFERNAL_ERUPTION); + Talk(SAY_INFERNAL_ERUPTION); + DoCast(SPELL_INFERNAL_ERUPTION); + events.ScheduleEvent(EVENT_SUMMON_INFERNAL_ERUPTION, 2*MINUTE*IN_MILLISECONDS); + return; + } } - m_uiLegionFlameTimer = 30*IN_MILLISECONDS; - } else m_uiLegionFlameTimer -= uiDiff; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; + CreatureAI* GetAI(Creature* creature) const + { + return new boss_jaraxxusAI(creature); + } }; class mob_legion_flame : public CreatureScript { -public: - mob_legion_flame() : CreatureScript("mob_legion_flame") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_legion_flameAI(creature); - } + public: + mob_legion_flame() : CreatureScript("mob_legion_flame") { } - struct mob_legion_flameAI : public Scripted_NoMovementAI - { - mob_legion_flameAI(Creature* creature) : Scripted_NoMovementAI(creature) + struct mob_legion_flameAI : public Scripted_NoMovementAI { - Reset(); - } + mob_legion_flameAI(Creature* creature) : Scripted_NoMovementAI(creature) + { + _instance = creature->GetInstanceScript(); + } - void Reset() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetInCombatWithZone(); - DoCast(SPELL_LEGION_FLAME_EFFECT); - } + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetInCombatWithZone(); + DoCast(SPELL_LEGION_FLAME_EFFECT); + } + + void UpdateAI(const uint32 /*diff*/) + { + UpdateVictim(); + if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS) + me->DespawnOrUnsummon(); + } + private: + InstanceScript* _instance; + }; - void UpdateAI(const uint32 /*uiDiff*/) + CreatureAI* GetAI(Creature* creature) const { - UpdateVictim(); + return new mob_legion_flameAI(creature); } - }; - }; class mob_infernal_volcano : public CreatureScript { -public: - mob_infernal_volcano() : CreatureScript("mob_infernal_volcano") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_infernal_volcanoAI(creature); - } + public: + mob_infernal_volcano() : CreatureScript("mob_infernal_volcano") { } - struct mob_infernal_volcanoAI : public Scripted_NoMovementAI - { - mob_infernal_volcanoAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me) + struct mob_infernal_volcanoAI : public Scripted_NoMovementAI { - instance = creature->GetInstanceScript(); - Reset(); - } + mob_infernal_volcanoAI(Creature* creature) : Scripted_NoMovementAI(creature), _summons(me) + { + } - InstanceScript* instance; + void Reset() + { + me->SetReactState(REACT_PASSIVE); - SummonList Summons; + if (!IsHeroic()) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); + else + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); - void Reset() - { - me->SetReactState(REACT_PASSIVE); + _summons.DespawnAll(); + } - if (!IsHeroic()) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); - else - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); + void IsSummonedBy(Unit* /*summoner*/) + { + DoCast(SPELL_INFERNAL_ERUPTION_EFFECT); + } - Summons.DespawnAll(); - } + void JustSummoned(Creature* summoned) + { + _summons.Summon(summoned); + // makes immediate corpse despawn of summoned Felflame Infernals + summoned->SetCorpseDelay(0); + } - void IsSummonedBy(Unit* /*summoner*/) - { - DoCast(SPELL_INFERNAL_ERUPTION_EFFECT); - } + void JustDied(Unit* /*killer*/) + { + // used to despawn corpse immediately + me->DespawnOrUnsummon(); + } - void JustSummoned(Creature* summoned) - { - Summons.Summon(summoned); - // makes immediate corpse despawn of summoned Felflame Infernals - summoned->SetCorpseDelay(0); - } + void UpdateAI(uint32 const /*diff*/) {} + + private: + SummonList _summons; + }; - void JustDied(Unit* /*killer*/) + CreatureAI* GetAI(Creature* creature) const { - // used to despawn corpse immediately - me->DespawnOrUnsummon(); + return new mob_infernal_volcanoAI(creature); } - - void UpdateAI(uint32 const /*diff*/) {} - }; - }; class mob_fel_infernal : public CreatureScript { -public: - mob_fel_infernal() : CreatureScript("mob_fel_infernal") { } + public: + mob_fel_infernal() : CreatureScript("mob_fel_infernal") { } - CreatureAI* GetAI(Creature* creature) const - { - return new mob_fel_infernalAI(creature); - } - - struct mob_fel_infernalAI : public ScriptedAI - { - mob_fel_infernalAI(Creature* creature) : ScriptedAI(creature) + struct mob_fel_infernalAI : public ScriptedAI { - instance = creature->GetInstanceScript(); - Reset(); - } - - InstanceScript* instance; - uint32 m_uiFelStreakTimer; + mob_fel_infernalAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + } - void Reset() - { - m_uiFelStreakTimer = 30*IN_MILLISECONDS; - me->SetInCombatWithZone(); - } + void Reset() + { + _felStreakTimer = 30*IN_MILLISECONDS; + me->SetInCombatWithZone(); + } - /*void SpellHitTarget(Unit* target, const SpellInfo* pSpell) - { - if (pSpell->Id == SPELL_FEL_STREAK) - DoCastAOE(SPELL_FEL_INFERNO); //66517 - }*/ + void UpdateAI(const uint32 diff) + { + if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS) + { + me->DespawnOrUnsummon(); + return; + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (instance && instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS) - me->DespawnOrUnsummon(); + if (_felStreakTimer <= diff) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + DoCast(target, SPELL_FEL_STREAK); + _felStreakTimer = 30*IN_MILLISECONDS; + } + else + _felStreakTimer -= diff; - if (m_uiFelStreakTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_FEL_STREAK); - m_uiFelStreakTimer = 30*IN_MILLISECONDS; - } else m_uiFelStreakTimer -= uiDiff; + DoMeleeAttackIfReady(); + } + private: + uint32 _felStreakTimer; + InstanceScript* _instance; + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new mob_fel_infernalAI(creature); } - }; - }; class mob_nether_portal : public CreatureScript { -public: - mob_nether_portal() : CreatureScript("mob_nether_portal") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_nether_portalAI(creature); - } + public: + mob_nether_portal() : CreatureScript("mob_nether_portal") { } - struct mob_nether_portalAI : public ScriptedAI - { - mob_nether_portalAI(Creature* creature) : ScriptedAI(creature), Summons(me) + struct mob_nether_portalAI : public ScriptedAI { - instance = creature->GetInstanceScript(); - Reset(); - } + mob_nether_portalAI(Creature* creature) : ScriptedAI(creature), _summons(me) + { + } - InstanceScript* instance; + void Reset() + { + me->SetReactState(REACT_PASSIVE); - SummonList Summons; + if (!IsHeroic()) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); + else + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); - void Reset() - { - me->SetReactState(REACT_PASSIVE); + _summons.DespawnAll(); + } - if (!IsHeroic()) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); - else - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); + void IsSummonedBy(Unit* /*summoner*/) + { + DoCast(SPELL_NETHER_PORTAL_EFFECT); + } - Summons.DespawnAll(); - } + void JustSummoned(Creature* summoned) + { + _summons.Summon(summoned); + // makes immediate corpse despawn of summoned Mistress of Pain + summoned->SetCorpseDelay(0); + } - void IsSummonedBy(Unit* /*summoner*/) - { - DoCast(SPELL_NETHER_PORTAL_EFFECT); - } + void JustDied(Unit* /*killer*/) + { + // used to despawn corpse immediately + me->DespawnOrUnsummon(); + } - void JustSummoned(Creature* summoned) - { - Summons.Summon(summoned); - // makes immediate corpse despawn of summoned Mistress of Pain - summoned->SetCorpseDelay(0); - } + void UpdateAI(uint32 const /*diff*/) {} + + private: + SummonList _summons; + }; - void JustDied(Unit* /*killer*/) + CreatureAI* GetAI(Creature* creature) const { - // used to despawn corpse immediately - me->DespawnOrUnsummon(); + return new mob_nether_portalAI(creature); } - - void UpdateAI(uint32 const /*diff*/) {} - }; - }; class mob_mistress_of_pain : public CreatureScript { -public: - mob_mistress_of_pain() : CreatureScript("mob_mistress_of_pain") { } + public: + mob_mistress_of_pain() : CreatureScript("mob_mistress_of_pain") { } - CreatureAI* GetAI(Creature* creature) const - { - return new mob_mistress_of_painAI(creature); - } + struct mob_mistress_of_painAI : public ScriptedAI + { + mob_mistress_of_painAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + if (_instance) + _instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, INCREASE); + } + + void Reset() + { + _events.ScheduleEvent(EVENT_SHIVAN_SLASH, 30*IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_SPINNING_STRIKE, 30*IN_MILLISECONDS); + if (IsHeroic()) + _events.ScheduleEvent(EVENT_MISTRESS_KISS, 15*IN_MILLISECONDS); + me->SetInCombatWithZone(); + } - struct mob_mistress_of_painAI : public ScriptedAI - { - mob_mistress_of_painAI(Creature* creature) : ScriptedAI(creature) + void JustDied(Unit* /*killer*/) + { + if (_instance) + _instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, DECREASE); + } + + void UpdateAI(const uint32 diff) + { + if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS) + { + me->DespawnOrUnsummon(); + return; + } + + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SHIVAN_SLASH: + DoCastVictim(SPELL_SHIVAN_SLASH); + _events.ScheduleEvent(EVENT_SHIVAN_SLASH, 30*IN_MILLISECONDS); + return; + case EVENT_SPINNING_STRIKE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + DoCast(target, SPELL_SPINNING_STRIKE); + _events.ScheduleEvent(EVENT_SPINNING_STRIKE, 30*IN_MILLISECONDS); + return; + case EVENT_MISTRESS_KISS: + DoCast(me, SPELL_MISTRESS_KISS); + _events.ScheduleEvent(EVENT_MISTRESS_KISS, 30*IN_MILLISECONDS); + return; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + private: + InstanceScript* _instance; + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const { - instance = creature->GetInstanceScript(); - if (instance) - instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, INCREASE); - Reset(); + return new mob_mistress_of_painAI(creature); } +}; - InstanceScript* instance; - uint32 m_uiShivanSlashTimer; - uint32 m_uiSpinningStrikeTimer; - uint32 m_uiMistressKissTimer; +class spell_mistress_kiss : public SpellScriptLoader +{ + public: + spell_mistress_kiss() : SpellScriptLoader("spell_mistress_kiss") { } - void Reset() + class spell_mistress_kiss_AuraScript : public AuraScript { - m_uiShivanSlashTimer = 30*IN_MILLISECONDS; - m_uiSpinningStrikeTimer = 30*IN_MILLISECONDS; - m_uiMistressKissTimer = 15*IN_MILLISECONDS; - me->SetInCombatWithZone(); - } + PrepareAuraScript(spell_mistress_kiss_AuraScript); - void JustDied(Unit* /*killer*/) + bool Load() + { + if (GetCaster()) + if (sSpellMgr->GetSpellIdForDifficulty(SPELL_MISTRESS_KISS_DAMAGE_SILENCE, GetCaster())) + return true; + return false; + } + + void HandleDummyTick(AuraEffect const* /*aurEff*/) + { + Unit* caster = GetCaster(); + Unit* target = GetTarget(); + if (caster && target) + { + if (target->HasUnitState(UNIT_STATE_CASTING)) + { + caster->CastSpell(target, SPELL_MISTRESS_KISS_DAMAGE_SILENCE, true); + target->RemoveAurasDueToSpell(GetSpellInfo()->Id); + } + } + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mistress_kiss_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const { - if (instance) - instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, DECREASE); + return new spell_mistress_kiss_AuraScript(); } +}; - void UpdateAI(const uint32 uiDiff) +class spell_mistress_kiss_area : public SpellScriptLoader +{ + public: + spell_mistress_kiss_area() : SpellScriptLoader("spell_mistress_kiss_area") {} + + class spell_mistress_kiss_area_SpellScript : public SpellScript { - if (instance && instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS) + PrepareSpellScript(spell_mistress_kiss_area_SpellScript) + + bool Load() { - me->DespawnOrUnsummon(); - return; + if (GetCaster()) + if (sSpellMgr->GetSpellIdForDifficulty(SPELL_MISTRESS_KISS_DEBUFF, GetCaster())) + return true; + return false; } - if (!UpdateVictim()) - return; - - if (m_uiShivanSlashTimer <= uiDiff) + void HandleScript(SpellEffIndex /*effIndex*/) { - DoCastVictim(SPELL_SHIVAN_SLASH); - m_uiShivanSlashTimer = 30*IN_MILLISECONDS; - } else m_uiShivanSlashTimer -= uiDiff; + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + if (caster && target) + caster->CastSpell(target, SPELL_MISTRESS_KISS_DEBUFF, true); + } - if (m_uiSpinningStrikeTimer <= uiDiff) + void FilterTargets(std::list<WorldObject*>& targets) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) - DoCast(target, SPELL_SPINNING_STRIKE); - m_uiSpinningStrikeTimer = 30*IN_MILLISECONDS; - } else m_uiSpinningStrikeTimer -= uiDiff; + // get a list of players with mana + std::list<WorldObject*> _targets; + for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) + if ((*itr)->ToUnit()->getPowerType() == POWER_MANA) + _targets.push_back(*itr); + + // pick a random target and kiss him + if (WorldObject* _target = Trinity::Containers::SelectRandomContainerElement(_targets)) + { + // correctly fill "targets" for the visual effect + targets.clear(); + targets.push_back(_target); + if (Unit* caster = GetCaster()) + caster->CastSpell(_target->ToUnit(), SPELL_MISTRESS_KISS_DEBUFF, true); + } + } - if (IsHeroic() && m_uiMistressKissTimer <= uiDiff) + void Register() { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) - DoCast(target, SPELL_MISTRESS_KISS); - m_uiMistressKissTimer = 30*IN_MILLISECONDS; - } else m_uiMistressKissTimer -= uiDiff; + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mistress_kiss_area_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - DoMeleeAttackIfReady(); + SpellScript* GetSpellScript() const + { + return new spell_mistress_kiss_area_SpellScript(); } - }; - }; void AddSC_boss_jaraxxus() @@ -530,4 +597,7 @@ void AddSC_boss_jaraxxus() new mob_fel_infernal(); new mob_nether_portal(); new mob_mistress_of_pain(); + + new spell_mistress_kiss(); + new spell_mistress_kiss_area(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 506467be8a5..106abe6fa52 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -15,23 +15,16 @@ * 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 -SDName: northrend_beasts -SD%Complete: 90% -SDComment: based on /dev/rsa -SDCategory: -EndScriptData */ // Known bugs: -// Gormok - Not implemented as a vehicle -// - Snobold Firebomb -// - Snobolled (creature at back) -// Snakes - miss the 1-hitkill from emerging -// - visual changes between mobile and stationary models seems not to work sometimes +// Gormok - Snobolled (creature at back) #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "trial_of_the_crusader.h" +#include "Vehicle.h" +#include "Player.h" +#include "SpellScript.h" enum Yells { @@ -44,7 +37,7 @@ enum Yells // Icehowl EMOTE_TRAMPLE_START = 0, EMOTE_TRAMPLE_CRASH = 1, - EMOTE_TRAMPLE_FAIL = 2, + EMOTE_TRAMPLE_FAIL = 2 }; enum Equipment @@ -52,7 +45,7 @@ enum Equipment EQUIP_MAIN = 50760, EQUIP_OFFHAND = 48040, EQUIP_RANGED = 47267, - EQUIP_DONE = EQUIP_NO_CHANGE, + EQUIP_DONE = EQUIP_NO_CHANGE }; enum Model @@ -60,13 +53,15 @@ enum Model MODEL_ACIDMAW_STATIONARY = 29815, MODEL_ACIDMAW_MOBILE = 29816, MODEL_DREADSCALE_STATIONARY = 26935, - MODEL_DREADSCALE_MOBILE = 24564, + MODEL_DREADSCALE_MOBILE = 24564 }; -enum Summons +enum BeastSummons { NPC_SNOBOLD_VASSAL = 34800, + NPC_FIRE_BOMB = 34854, NPC_SLIME_POOL = 35176, + MAX_SNOBOLDS = 4 }; enum BossSpells @@ -107,332 +102,446 @@ enum BossSpells SPELL_ARCTIC_BREATH = 66689, SPELL_TRAMPLE = 66734, SPELL_FROTHING_RAGE = 66759, - SPELL_STAGGERED_DAZE = 66758, + SPELL_STAGGERED_DAZE = 66758 }; -class boss_gormok : public CreatureScript +enum MyActions { -public: - boss_gormok() : CreatureScript("boss_gormok") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new boss_gormokAI(creature); - } + ACTION_ENABLE_FIRE_BOMB = 1, + ACTION_DISABLE_FIRE_BOMB = 2 +}; - struct boss_gormokAI : public ScriptedAI - { - boss_gormokAI(Creature* creature) : ScriptedAI(creature), Summons(me) - { - instance = creature->GetInstanceScript(); - } +enum Events +{ + // Gormok + EVENT_IMPALE = 1, + EVENT_STAGGERING_STOMP = 2, + EVENT_THROW = 3, - InstanceScript* instance; + // Snobold + EVENT_FIRE_BOMB = 4, + EVENT_BATTER = 5, + EVENT_HEAD_CRACK = 6, - uint32 m_uiImpaleTimer; - uint32 m_uiStaggeringStompTimer; - SummonList Summons; - uint32 m_uiSummonTimer; - uint32 m_uiSummonCount; + // Acidmaw & Dreadscale + EVENT_BITE = 7, + EVENT_SPEW = 8, + EVENT_SLIME_POOL = 9, + EVENT_SPIT = 10, + EVENT_SPRAY = 11, + EVENT_SWEEP = 12, + EVENT_SUBMERGE = 13, + EVENT_EMERGE = 14, + EVENT_SUMMON_ACIDMAW = 15, - void Reset() - { - m_uiImpaleTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - m_uiStaggeringStompTimer = 15*IN_MILLISECONDS; - m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);; + // Icehowl + EVENT_FEROCIOUS_BUTT = 16, + EVENT_MASSIVE_CRASH = 17, + EVENT_WHIRL = 18, + EVENT_ARCTIC_BREATH = 19, + EVENT_TRAMPLE = 20 +}; - if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || - GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) - m_uiSummonCount = 5; - else - m_uiSummonCount = 4; +enum Phases +{ + PHASE_MOBILE = 1, + PHASE_STATIONARY = 2, + PHASE_SUBMERGED = 3, - Summons.DespawnAll(); - } + PHASE_MASK_MOBILE = 1 << PHASE_MOBILE, + PHASE_MASK_STATIONARY = 1 << PHASE_STATIONARY +}; - void EnterEvadeMode() - { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - ScriptedAI::EnterEvadeMode(); - } +class boss_gormok : public CreatureScript +{ + public: + boss_gormok() : CreatureScript("boss_gormok") { } - void MovementInform(uint32 type, uint32 pointId) + struct boss_gormokAI : public BossAI { - if (type != POINT_MOTION_TYPE) - return; - - switch (pointId) + boss_gormokAI(Creature* creature) : BossAI(creature, BOSS_BEASTS) { - case 0: - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetInCombatWithZone(); - break; } - } - void JustDied(Unit* /*killer*/) - { - if (instance) - instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_DONE); - } + void Reset() + { + events.ScheduleEvent(EVENT_IMPALE, urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_STAGGERING_STOMP, 15*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_THROW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); - void JustReachedHome() - { - if (instance) + summons.DespawnAll(); + } + + void EnterEvadeMode() { instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); + ScriptedAI::EnterEvadeMode(); } - me->DespawnOrUnsummon(); - } - void EnterCombat(Unit* /*who*/) - { - me->SetInCombatWithZone(); - instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_IN_PROGRESS); - } - - void JustSummoned(Creature* summon) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) + void MovementInform(uint32 type, uint32 pointId) { - if (summon->GetEntry() == NPC_SNOBOLD_VASSAL) + if (type != POINT_MOTION_TYPE) + return; + + switch (pointId) { - summon->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 10.0f, 20.0f); - DoCast(me, SPELL_RISING_ANGER); - --m_uiSummonCount; + case 0: + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + break; + default: + break; } - summon->AI()->AttackStart(target); } - Summons.Summon(summon); - } - void SummonedCreatureDespawn(Creature* summon) - { - if (summon->GetEntry() == NPC_SNOBOLD_VASSAL) - if (summon->isAlive()) - ++m_uiSummonCount; - Summons.Despawn(summon); - } + void JustDied(Unit* /*killer*/) + { + if (instance) + instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_DONE); + } - void UpdateAI(uint32 const diff) - { - if (!UpdateVictim()) - return; + void JustReachedHome() + { + if (instance) + { + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); + } + me->DespawnOrUnsummon(); + } - if (m_uiImpaleTimer <= diff) + void EnterCombat(Unit* /*who*/) { - DoCastVictim(SPELL_IMPALE); - m_uiImpaleTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - } else m_uiImpaleTimer -= diff; + _EnterCombat(); + me->SetInCombatWithZone(); + instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_IN_PROGRESS); - if (m_uiStaggeringStompTimer <= diff) + for (uint8 i = 0; i < MAX_SNOBOLDS; i++) + { + if (Creature* pSnobold = DoSpawnCreature(NPC_SNOBOLD_VASSAL, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0)) + { + pSnobold->EnterVehicle(me, i); + pSnobold->SetInCombatWithZone(); + pSnobold->AI()->DoAction(ACTION_ENABLE_FIRE_BOMB); + } + } + } + + void DamageTaken(Unit* /*who*/, uint32& damage) { - DoCastVictim(SPELL_STAGGERING_STOMP); - m_uiStaggeringStompTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiStaggeringStompTimer -= diff; + // despawn the remaining passengers on death + if (damage >= me->GetHealth()) + for (uint8 i = 0; i < MAX_SNOBOLDS; ++i) + if (Unit* pSnobold = me->GetVehicleKit()->GetPassenger(i)) + pSnobold->ToCreature()->DespawnOrUnsummon(); + } - if (m_uiSummonTimer <= diff) + void UpdateAI(uint32 const diff) { - if (m_uiSummonCount > 0) + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - me->SummonCreature(NPC_SNOBOLD_VASSAL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN); - Talk(EMOTE_SNOBOLLED); + switch (eventId) + { + case EVENT_IMPALE: + DoCastVictim(SPELL_IMPALE); + events.ScheduleEvent(EVENT_IMPALE, urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS)); + return; + case EVENT_STAGGERING_STOMP: + DoCastVictim(SPELL_STAGGERING_STOMP); + events.ScheduleEvent(EVENT_STAGGERING_STOMP, 15*IN_MILLISECONDS); + return; + case EVENT_THROW: + for (uint8 i = 0; i < MAX_SNOBOLDS; ++i) + { + if (Unit* pSnobold = me->GetVehicleKit()->GetPassenger(i)) + { + pSnobold->ExitVehicle(); + pSnobold->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + pSnobold->ToCreature()->SetReactState(REACT_AGGRESSIVE); + pSnobold->ToCreature()->AI()->DoAction(ACTION_DISABLE_FIRE_BOMB); + pSnobold->CastSpell(me, SPELL_RISING_ANGER, true); + Talk(EMOTE_SNOBOLLED); + break; + } + } + events.ScheduleEvent(EVENT_THROW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + default: + return; + } } - m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiSummonTimer -= diff; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; + CreatureAI* GetAI(Creature* creature) const + { + return new boss_gormokAI(creature); + } }; class mob_snobold_vassal : public CreatureScript { -public: - mob_snobold_vassal() : CreatureScript("mob_snobold_vassal") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_snobold_vassalAI(creature); - } + public: + mob_snobold_vassal() : CreatureScript("mob_snobold_vassal") { } - struct mob_snobold_vassalAI : public ScriptedAI - { - mob_snobold_vassalAI(Creature* creature) : ScriptedAI(creature) + struct mob_snobold_vassalAI : public ScriptedAI { - instance = creature->GetInstanceScript(); - if (instance) - instance->SetData(DATA_SNOBOLD_COUNT, INCREASE); - } + mob_snobold_vassalAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + if (_instance) + _instance->SetData(DATA_SNOBOLD_COUNT, INCREASE); + } - InstanceScript* instance; - uint32 m_uiFireBombTimer; - uint32 m_uiBatterTimer; - uint32 m_uiHeadCrackTimer; - uint64 m_uiBossGUID; - uint64 m_uiTargetGUID; - bool m_bTargetDied; + void Reset() + { + _events.ScheduleEvent(EVENT_BATTER, 5*IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_HEAD_CRACK, 25*IN_MILLISECONDS); - void Reset() - { - m_uiFireBombTimer = 15000; - m_uiBatterTimer = 5000; - m_uiHeadCrackTimer = 25000; + _targetGUID = 0; + _targetDied = false; - m_uiTargetGUID = 0; - m_bTargetDied = false; - if (instance) - m_uiBossGUID = instance->GetData64(NPC_GORMOK); - //Workaround for Snobold - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - } - - void EnterEvadeMode() - { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - ScriptedAI::EnterEvadeMode(); - } + if (_instance) + _bossGUID = _instance->GetData64(NPC_GORMOK); + //Workaround for Snobold + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + } - void EnterCombat(Unit* who) - { - m_uiTargetGUID = who->GetGUID(); - me->TauntApply(who); - DoCast(who, SPELL_SNOBOLLED); - } + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (pDoneBy->GetGUID()==m_uiTargetGUID) - uiDamage = 0; - } + void EnterCombat(Unit* who) + { + _targetGUID = who->GetGUID(); + me->TauntApply(who); + DoCast(who, SPELL_SNOBOLLED); + } - void MovementInform(uint32 type, uint32 pointId) - { - if (type != POINT_MOTION_TYPE) - return; + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (pDoneBy->GetGUID() == _targetGUID) + uiDamage = 0; + } - switch (pointId) + void MovementInform(uint32 type, uint32 pointId) { - case 0: - if (m_bTargetDied) - me->DespawnOrUnsummon(); - break; + if (type != POINT_MOTION_TYPE) + return; + + switch (pointId) + { + case 0: + if (_targetDied) + me->DespawnOrUnsummon(); + break; + default: + break; + } } - } - void JustDied(Unit* /*killer*/) - { - if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) - if (target->isAlive()) - target->RemoveAurasDueToSpell(SPELL_SNOBOLLED); - if (instance) - instance->SetData(DATA_SNOBOLD_COUNT, DECREASE); - } + void JustDied(Unit* /*killer*/) + { + if (Unit* target = Unit::GetPlayer(*me, _targetGUID)) + if (target->isAlive()) + target->RemoveAurasDueToSpell(SPELL_SNOBOLLED); + if (_instance) + _instance->SetData(DATA_SNOBOLD_COUNT, DECREASE); + } - void UpdateAI(uint32 const diff) - { - if (m_bTargetDied || !UpdateVictim()) - return; + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_ENABLE_FIRE_BOMB: + _events.ScheduleEvent(EVENT_FIRE_BOMB, urand(5*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + break; + case ACTION_DISABLE_FIRE_BOMB: + _events.CancelEvent(EVENT_FIRE_BOMB); + break; + default: + break; + } + } - if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) + void UpdateAI(uint32 const diff) { - if (!target->isAlive()) + if (!UpdateVictim() || _targetDied) + return; + + if (Unit* target = Unit::GetPlayer(*me, _targetGUID)) { - if (instance) + if (!target->isAlive()) { - Unit* gormok = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GORMOK)); - if (gormok && gormok->isAlive()) + if (_instance) { - SetCombatMovement(false); - m_bTargetDied = true; - me->GetMotionMaster()->MoveJump(gormok->GetPositionX(), gormok->GetPositionY(), gormok->GetPositionZ(), 15.0f, 15.0f); - } - else if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - m_uiTargetGUID = target2->GetGUID(); - me->GetMotionMaster()->MoveJump(target2->GetPositionX(), target2->GetPositionY(), target2->GetPositionZ(), 15.0f, 15.0f); + Unit* gormok = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_GORMOK)); + if (gormok && gormok->isAlive()) + { + SetCombatMovement(false); + _targetDied = true; + + // looping through Gormoks seats + for (uint8 i = 0; i < MAX_SNOBOLDS; i++) + { + if (!gormok->GetVehicleKit()->GetPassenger(i)) + { + me->EnterVehicle(gormok, i); + DoAction(ACTION_ENABLE_FIRE_BOMB); + break; + } + } + } + else if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + _targetGUID = target2->GetGUID(); + me->GetMotionMaster()->MoveJump(target2->GetPositionX(), target2->GetPositionY(), target2->GetPositionZ(), 15.0f, 15.0f); + } } } } + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FIRE_BOMB: + if (me->GetVehicleBase()) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -me->GetVehicleBase()->GetCombatReach(), true)) + me->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_FIRE_BOMB, true); + _events.ScheduleEvent(EVENT_FIRE_BOMB, 20*IN_MILLISECONDS); + return; + case EVENT_HEAD_CRACK: + // commented out while SPELL_SNOBOLLED gets fixed + //if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) + DoCastVictim(SPELL_HEAD_CRACK); + _events.ScheduleEvent(EVENT_HEAD_CRACK, 30*IN_MILLISECONDS); + return; + case EVENT_BATTER: + // commented out while SPELL_SNOBOLLED gets fixed + //if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) + DoCastVictim(SPELL_BATTER); + _events.ScheduleEvent(EVENT_BATTER, 10*IN_MILLISECONDS); + return; + default: + return; + } + } + + // do melee attack only when not on Gormoks back + if (!me->GetVehicleBase()) + DoMeleeAttackIfReady(); } + private: + EventMap _events; + InstanceScript* _instance; + uint64 _bossGUID; + uint64 _targetGUID; + bool _targetDied; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_snobold_vassalAI(creature); + } +}; + +class npc_firebomb : public CreatureScript +{ + public: + npc_firebomb() : CreatureScript("npc_firebomb") { } - if (m_uiFireBombTimer < diff) + struct npc_firebombAI : public ScriptedAI + { + npc_firebombAI(Creature* creature) : ScriptedAI(creature) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_FIRE_BOMB); - m_uiFireBombTimer = 20000; + _instance = creature->GetInstanceScript(); } - else m_uiFireBombTimer -= diff; - if (m_uiBatterTimer < diff) + void Reset() { - if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) - DoCast(target, SPELL_BATTER); - m_uiBatterTimer = 10000; + DoCast(me, SPELL_FIRE_BOMB_DOT, true); + SetCombatMovement(false); + me->SetReactState(REACT_PASSIVE); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); } - else m_uiBatterTimer -= diff; - if (m_uiHeadCrackTimer < diff) + void UpdateAI(uint32 const /*diff*/) { - if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) - DoCast(target, SPELL_HEAD_CRACK); - m_uiHeadCrackTimer = 35000; + if (_instance->GetData(TYPE_NORTHREND_BEASTS) != GORMOK_IN_PROGRESS) + me->DespawnOrUnsummon(); } - else m_uiHeadCrackTimer -= diff; - DoMeleeAttackIfReady(); - } - }; + private: + InstanceScript* _instance; + }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_firebombAI(creature); + } }; -struct boss_jormungarAI : public ScriptedAI +struct boss_jormungarAI : public BossAI { - boss_jormungarAI(Creature* creature) : ScriptedAI(creature) + boss_jormungarAI(Creature* creature) : BossAI(creature, BOSS_BEASTS) { - instanceScript = creature->GetInstanceScript(); } void Reset() { - enraged = false; - biteTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - spewTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - slimePoolTimer = 15*IN_MILLISECONDS; - spitTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - sprayTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - sweepTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); + Enraged = false; + + events.ScheduleEvent(EVENT_SPIT, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY); + events.ScheduleEvent(EVENT_SPRAY, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY); + events.ScheduleEvent(EVENT_SWEEP, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY); + events.ScheduleEvent(EVENT_BITE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE); + events.ScheduleEvent(EVENT_SPEW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE); + events.ScheduleEvent(EVENT_SLIME_POOL, 15*IN_MILLISECONDS, 0, PHASE_MOBILE); } void JustDied(Unit* /*killer*/) { - if (instanceScript) + if (instance) { - if (Creature* otherWorm = Unit::GetCreature(*me, instanceScript->GetData64(otherWormEntry))) + if (Creature* otherWorm = Unit::GetCreature(*me, instance->GetData64(OtherWormEntry))) { if (!otherWorm->isAlive()) { - instanceScript->SetData(TYPE_NORTHREND_BEASTS, SNAKES_DONE); + instance->SetData(TYPE_NORTHREND_BEASTS, SNAKES_DONE); me->DespawnOrUnsummon(); otherWorm->DespawnOrUnsummon(); } else - instanceScript->SetData(TYPE_NORTHREND_BEASTS, SNAKES_SPECIAL); + instance->SetData(TYPE_NORTHREND_BEASTS, SNAKES_SPECIAL); } } } void JustReachedHome() { - if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) != FAIL) - { - instanceScript->SetData(TYPE_NORTHREND_BEASTS, FAIL); - } + // prevent losing 2 attempts at once on heroics + if (instance && instance->GetData(TYPE_NORTHREND_BEASTS) != FAIL) + instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); me->DespawnOrUnsummon(); } @@ -440,17 +549,16 @@ struct boss_jormungarAI : public ScriptedAI void KilledUnit(Unit* who) { if (who->GetTypeId() == TYPEID_PLAYER) - { - if (instanceScript) - instanceScript->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); - } + if (instance) + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } void EnterCombat(Unit* /*who*/) { + _EnterCombat(); me->SetInCombatWithZone(); - if (instanceScript) - instanceScript->SetData(TYPE_NORTHREND_BEASTS, SNAKES_IN_PROGRESS); + if (instance) + instance->SetData(TYPE_NORTHREND_BEASTS, SNAKES_IN_PROGRESS); } void UpdateAI(uint32 const diff) @@ -458,563 +566,597 @@ struct boss_jormungarAI : public ScriptedAI if (!UpdateVictim()) return; - if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged) + if (!Enraged && instance && instance->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL) { me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(SPELL_ENRAGE); - enraged = true; + Enraged = true; Talk(EMOTE_ENRAGE); - switch (stage) - { - case 0: - break; - case 4: - stage = 5; - submergeTimer = 5*IN_MILLISECONDS; - break; - default: - stage = 7; - } } - switch (stage) - { - case 0: // Mobile - if (biteTimer <= diff) - { - DoCastVictim(biteSpell); - biteTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else biteTimer -= diff; + events.Update(diff); - if (spewTimer <= diff) - { - DoCastAOE(spewSpell); - spewTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else spewTimer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (slimePoolTimer <= diff) - { - /* Spell summon has only 30s duration */ + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_EMERGE: + Emerge(); + return; + case EVENT_SUBMERGE: + Submerge(); + return; + case EVENT_BITE: + DoCastVictim(BiteSpell); + events.ScheduleEvent(EVENT_BITE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE); + return; + case EVENT_SPEW: + DoCastAOE(SpewSpell); + events.ScheduleEvent(EVENT_SPEW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE); + return; + case EVENT_SLIME_POOL: DoCast(me, SUMMON_SLIME_POOL); - slimePoolTimer = 30*IN_MILLISECONDS; - } else slimePoolTimer -= diff; - - if (submergeTimer <= diff && !enraged) - { - stage = 1; - submergeTimer = 5*IN_MILLISECONDS; - } else submergeTimer -= diff; - - DoMeleeAttackIfReady(); - break; - case 1: // Submerge - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_SUBMERGE_0); - me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); - stage = 2; - case 2: // Wait til emerge - if (submergeTimer <= diff) - { - stage = 3; - submergeTimer = 50*IN_MILLISECONDS; - } else submergeTimer -= diff; - break; - case 3: // Emerge - me->SetDisplayId(modelStationary); - me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); - DoCast(me, SPELL_EMERGE_0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - SetCombatMovement(false); - me->GetMotionMaster()->MoveIdle(); - stage = 4; - break; - case 4: // Stationary - if (sprayTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, spraySpell); - sprayTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else sprayTimer -= diff; - - if (sweepTimer <= diff) - { + events.ScheduleEvent(EVENT_SLIME_POOL, 30*IN_MILLISECONDS, 0, PHASE_MOBILE); + return; + case EVENT_SUMMON_ACIDMAW: + if (Creature* acidmaw = me->SummonCreature(NPC_ACIDMAW, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) + { + acidmaw->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + acidmaw->SetReactState(REACT_AGGRESSIVE); + acidmaw->SetInCombatWithZone(); + acidmaw->CastSpell(acidmaw, SPELL_EMERGE_0); + } + return; + case EVENT_SPRAY: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + DoCast(target, SpraySpell); + events.ScheduleEvent(EVENT_SPRAY, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY); + return; + case EVENT_SWEEP: DoCastAOE(SPELL_SWEEP_0); - sweepTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else sweepTimer -= diff; - - if (submergeTimer <= diff) - { - stage = 5; - submergeTimer = 10*IN_MILLISECONDS; - } else submergeTimer -= diff; - - DoSpellAttackIfReady(spitSpell); - break; - case 5: // Submerge - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_SUBMERGE_0); - me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); - stage = 6; - case 6: // Wait til emerge - if (submergeTimer <= diff) - { - stage = 7; - submergeTimer = 45*IN_MILLISECONDS; - } else submergeTimer -= diff; - break; - case 7: // Emerge - me->SetDisplayId(modelMobile); - me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); - DoCast(me, SPELL_EMERGE_0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - SetCombatMovement(true); - me->GetMotionMaster()->MoveChase(me->getVictim()); - stage = 0; - break; + events.ScheduleEvent(EVENT_SWEEP, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY); + return; + default: + return; + } } + if (events.GetPhaseMask() & PHASE_MASK_MOBILE) + DoMeleeAttackIfReady(); + if (events.GetPhaseMask() & PHASE_MASK_STATIONARY) + DoSpellAttackIfReady(SpitSpell); } - InstanceScript* instanceScript; + void Submerge() + { + DoCast(me, SPELL_SUBMERGE_0); + me->RemoveAurasDueToSpell(SPELL_EMERGE_0); + me->SetInCombatWithZone(); + events.SetPhase(PHASE_SUBMERGED); + events.ScheduleEvent(EVENT_EMERGE, 5*IN_MILLISECONDS, 0, PHASE_SUBMERGED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); + WasMobile = !WasMobile; + } - uint32 otherWormEntry; + void Emerge() + { + DoCast(me, SPELL_EMERGE_0); + me->SetDisplayId(ModelMobile); + me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->Clear(); + + // if the worm was mobile before submerging, make him stationary now + if (WasMobile) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + SetCombatMovement(false); + me->SetDisplayId(ModelStationary); + events.SetPhase(PHASE_STATIONARY); + events.ScheduleEvent(EVENT_SUBMERGE, 45*IN_MILLISECONDS, 0, PHASE_STATIONARY); + events.ScheduleEvent(EVENT_SPIT, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY); + events.ScheduleEvent(EVENT_SPRAY, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY); + events.ScheduleEvent(EVENT_SWEEP, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY); + } + else + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + SetCombatMovement(true); + me->GetMotionMaster()->MoveChase(me->getVictim()); + me->SetDisplayId(ModelMobile); + events.SetPhase(PHASE_MOBILE); + events.ScheduleEvent(EVENT_SUBMERGE, 45*IN_MILLISECONDS, 0, PHASE_MOBILE); + events.ScheduleEvent(EVENT_BITE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE); + events.ScheduleEvent(EVENT_SPEW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE); + events.ScheduleEvent(EVENT_SLIME_POOL, 15*IN_MILLISECONDS, 0, PHASE_MOBILE); + } + } - uint32 modelStationary; - uint32 modelMobile; + protected: + uint32 OtherWormEntry; + uint32 ModelStationary; + uint32 ModelMobile; - uint32 biteSpell; - uint32 spewSpell; - uint32 spitSpell; - uint32 spraySpell; + uint32 BiteSpell; + uint32 SpewSpell; + uint32 SpitSpell; + uint32 SpraySpell; - uint32 biteTimer; - uint32 spewTimer; - uint32 slimePoolTimer; - uint32 spitTimer; - uint32 sprayTimer; - uint32 sweepTimer; - uint32 submergeTimer; - uint8 stage; - bool enraged; + Phases Phase; + bool Enraged; + bool WasMobile; }; class boss_acidmaw : public CreatureScript { public: - boss_acidmaw() : CreatureScript("boss_acidmaw") { } + boss_acidmaw() : CreatureScript("boss_acidmaw") { } - struct boss_acidmawAI : public boss_jormungarAI - { - boss_acidmawAI(Creature* creature) : boss_jormungarAI(creature) { } + struct boss_acidmawAI : public boss_jormungarAI + { + boss_acidmawAI(Creature* creature) : boss_jormungarAI(creature) { } - void Reset() + void Reset() + { + boss_jormungarAI::Reset(); + BiteSpell = SPELL_PARALYTIC_BITE; + SpewSpell = SPELL_ACID_SPEW; + SpitSpell = SPELL_ACID_SPIT; + SpraySpell = SPELL_PARALYTIC_SPRAY; + ModelStationary = MODEL_ACIDMAW_STATIONARY; + ModelMobile = MODEL_ACIDMAW_MOBILE; + OtherWormEntry = NPC_DREADSCALE; + + WasMobile = true; + Emerge(); + } + }; + + CreatureAI* GetAI(Creature* creature) const { - boss_jormungarAI::Reset(); - biteSpell = SPELL_PARALYTIC_BITE; - spewSpell = SPELL_ACID_SPEW; - spitSpell = SPELL_ACID_SPIT; - spraySpell = SPELL_PARALYTIC_SPRAY; - modelStationary = MODEL_ACIDMAW_STATIONARY; - modelMobile = MODEL_ACIDMAW_MOBILE; - otherWormEntry = NPC_DREADSCALE; - - submergeTimer = 500; - DoCast(me, SPELL_SUBMERGE_0); - stage = 2; + return new boss_acidmawAI(creature); } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new boss_acidmawAI(creature); - } }; class boss_dreadscale : public CreatureScript { -public: - boss_dreadscale() : CreatureScript("boss_dreadscale") { } + public: + boss_dreadscale() : CreatureScript("boss_dreadscale") { } - struct boss_dreadscaleAI : public boss_jormungarAI - { - boss_dreadscaleAI(Creature* creature) : boss_jormungarAI(creature) + struct boss_dreadscaleAI : public boss_jormungarAI { - instanceScript = creature->GetInstanceScript(); - } + boss_dreadscaleAI(Creature* creature) : boss_jormungarAI(creature) + { + } - InstanceScript* instanceScript; + void Reset() + { + boss_jormungarAI::Reset(); + BiteSpell = SPELL_BURNING_BITE; + SpewSpell = SPELL_MOLTEN_SPEW; + SpitSpell = SPELL_FIRE_SPIT; + SpraySpell = SPELL_BURNING_SPRAY; + ModelStationary = MODEL_DREADSCALE_STATIONARY; + ModelMobile = MODEL_DREADSCALE_MOBILE; + OtherWormEntry = NPC_ACIDMAW; + + events.SetPhase(PHASE_MOBILE); + events.ScheduleEvent(EVENT_SUMMON_ACIDMAW, 3*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUBMERGE, 45*IN_MILLISECONDS, 0, PHASE_MOBILE); + WasMobile = false; + } - void Reset() - { - boss_jormungarAI::Reset(); - biteSpell = SPELL_BURNING_BITE; - spewSpell = SPELL_MOLTEN_SPEW; - spitSpell = SPELL_FIRE_SPIT; - spraySpell = SPELL_BURNING_SPRAY; - modelStationary = MODEL_DREADSCALE_STATIONARY; - modelMobile = MODEL_DREADSCALE_MOBILE; - otherWormEntry = NPC_ACIDMAW; - - submergeTimer = 45 * IN_MILLISECONDS; - stage = 0; - } + void MovementInform(uint32 type, uint32 pointId) + { + if (type != POINT_MOTION_TYPE) + return; - void MovementInform(uint32 type, uint32 pointId) - { - if (type != POINT_MOTION_TYPE) - return; + switch (pointId) + { + case 0: + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + break; + default: + break; + } + } - switch (pointId) + void EnterEvadeMode() { - case 0: - instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetInCombatWithZone(); - if (Creature* otherWorm = Unit::GetCreature(*me, instanceScript->GetData64(otherWormEntry))) - { - otherWorm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - otherWorm->SetReactState(REACT_AGGRESSIVE); - otherWorm->SetVisible(true); - otherWorm->SetInCombatWithZone(); - } - break; + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + boss_jormungarAI::EnterEvadeMode(); } - } - void EnterEvadeMode() - { - instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR)); - boss_jormungarAI::EnterEvadeMode(); - } + void JustReachedHome() + { + if (instance) + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - void JustReachedHome() - { - if (instanceScript) - instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR)); + boss_jormungarAI::JustReachedHome(); + } + }; - boss_jormungarAI::JustReachedHome(); + CreatureAI* GetAI(Creature* creature) const + { + return new boss_dreadscaleAI(creature); } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new boss_dreadscaleAI(creature); - } }; class mob_slime_pool : public CreatureScript { -public: - mob_slime_pool() : CreatureScript("mob_slime_pool") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_slime_poolAI(creature); - } - - struct mob_slime_poolAI : public ScriptedAI - { - mob_slime_poolAI(Creature* creature) : ScriptedAI(creature) - { - } + public: + mob_slime_pool() : CreatureScript("mob_slime_pool") { } - bool casted; - void Reset() + struct mob_slime_poolAI : public ScriptedAI { - casted = false; - me->SetReactState(REACT_PASSIVE); - } + mob_slime_poolAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + } - void UpdateAI(uint32 const /*diff*/) - { - if (!casted) + void Reset() { - casted = true; - DoCast(me, SPELL_SLIME_POOL_EFFECT); + _cast = false; + me->SetReactState(REACT_PASSIVE); } - } - }; -}; + void UpdateAI(uint32 const /*diff*/) + { + if (!_cast) + { + _cast = true; + DoCast(me, SPELL_SLIME_POOL_EFFECT); + } -class boss_icehowl : public CreatureScript -{ -public: - boss_icehowl() : CreatureScript("boss_icehowl") { } + if (_instance->GetData(TYPE_NORTHREND_BEASTS) != SNAKES_IN_PROGRESS && _instance->GetData(TYPE_NORTHREND_BEASTS) != SNAKES_SPECIAL) + me->DespawnOrUnsummon(); + } + private: + InstanceScript* _instance; + bool _cast; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_icehowlAI(creature); - } + }; - struct boss_icehowlAI : public ScriptedAI - { - boss_icehowlAI(Creature* creature) : ScriptedAI(creature) + CreatureAI* GetAI(Creature* creature) const { - instance = creature->GetInstanceScript(); + return new mob_slime_poolAI(creature); } +}; - InstanceScript* instance; - - uint32 m_uiFerociousButtTimer; - uint32 m_uiArticBreathTimer; - uint32 m_uiWhirlTimer; - uint32 m_uiMassiveCrashTimer; - uint32 m_uiTrampleTimer; - float m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ; - uint64 m_uiTrampleTargetGUID; - bool m_bMovementStarted; - bool m_bMovementFinish; - bool m_bTrampleCasted; - uint8 m_uiStage; - Unit* target; - - void Reset() +class spell_gormok_fire_bomb : public SpellScriptLoader +{ + public: + spell_gormok_fire_bomb() : SpellScriptLoader("spell_gormok_fire_bomb") {} + + class spell_gormok_fire_bomb_SpellScript : public SpellScript { - m_uiFerociousButtTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - m_uiArticBreathTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS); - m_uiWhirlTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - m_uiMassiveCrashTimer = 30*IN_MILLISECONDS; - m_uiTrampleTimer = IN_MILLISECONDS; - m_bMovementStarted = false; - m_bMovementFinish = false; - m_bTrampleCasted = false; - m_uiTrampleTargetGUID = 0; - m_fTrampleTargetX = 0; - m_fTrampleTargetY = 0; - m_fTrampleTargetZ = 0; - m_uiStage = 0; - } + PrepareSpellScript(spell_gormok_fire_bomb_SpellScript); + + void TriggerFireBomb(SpellEffIndex /*effIndex*/) + { + if (const WorldLocation* pos = GetExplTargetDest()) + { + if (Unit* caster = GetCaster()) + caster->SummonCreature(NPC_FIRE_BOMB, pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30*IN_MILLISECONDS); + } + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_gormok_fire_bomb_SpellScript::TriggerFireBomb, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE); + } + }; - void JustDied(Unit* /*killer*/) + SpellScript* GetSpellScript() const { - if (instance) - instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_DONE); + return new spell_gormok_fire_bomb_SpellScript(); } +}; + +class boss_icehowl : public CreatureScript +{ + public: + boss_icehowl() : CreatureScript("boss_icehowl") { } - void MovementInform(uint32 type, uint32 pointId) + struct boss_icehowlAI : public BossAI { - if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) - return; + boss_icehowlAI(Creature* creature) : BossAI(creature, BOSS_BEASTS) + { + } - switch (pointId) + void Reset() { - case 0: - if (me->GetDistance2d(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()) < 6.0f) - { - // Middle of the room - m_uiStage = 1; - } - else - { - // Landed from Hop backwards (start trample) - if (Unit::GetPlayer(*me, m_uiTrampleTargetGUID)) + events.ScheduleEvent(EVENT_FEROCIOUS_BUTT, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_ARCTIC_BREATH, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_WHIRL, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_MASSIVE_CRASH, 30*IN_MILLISECONDS); + _movementStarted = false; + _movementFinish = false; + _trampleCasted = false; + _trampleTargetGUID = 0; + _trampleTargetX = 0; + _trampleTargetY = 0; + _trampleTargetZ = 0; + _stage = 0; + } + + void JustDied(Unit* /*killer*/) + { + _JustDied(); + if (instance) + instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_DONE); + } + + void MovementInform(uint32 type, uint32 pointId) + { + if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) + return; + + switch (pointId) + { + case 0: + if (_stage != 0) { - m_uiStage = 4; + if (me->GetDistance2d(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()) < 6.0f) + // Middle of the room + _stage = 1; + else + { + // Landed from Hop backwards (start trample) + if (Unit::GetPlayer(*me, _trampleTargetGUID)) + _stage = 4; + else + _stage = 6; + } } - else - m_uiStage = 6; - } - break; - case 1: // Finish trample - m_bMovementFinish = true; - break; - case 2: - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetInCombatWithZone(); - break; + break; + case 1: // Finish trample + _movementFinish = true; + break; + case 2: + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + break; + default: + break; + } } - } - void EnterEvadeMode() - { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - ScriptedAI::EnterEvadeMode(); - } - - void JustReachedHome() - { - if (instance) + void EnterEvadeMode() { instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); + ScriptedAI::EnterEvadeMode(); } - me->DespawnOrUnsummon(); - } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) + void JustReachedHome() { if (instance) - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + { + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + instance->SetData(TYPE_NORTHREND_BEASTS, FAIL); + } + me->DespawnOrUnsummon(); } - } - - void EnterCombat(Unit* /*who*/) - { - if (instance) - instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_IN_PROGRESS); - me->SetInCombatWithZone(); - } - void SpellHitTarget(Unit* target, SpellInfo const* spell) - { - if (spell->Id == SPELL_TRAMPLE && target->GetTypeId() == TYPEID_PLAYER) + void KilledUnit(Unit* who) { - if (!m_bTrampleCasted) + if (who->GetTypeId() == TYPEID_PLAYER) { - DoCast(me, SPELL_FROTHING_RAGE, true); - m_bTrampleCasted = true; + if (instance) + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); } } - } - void UpdateAI(uint32 const diff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + if (instance) + instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_IN_PROGRESS); + } - switch (m_uiStage) + void SpellHitTarget(Unit* target, SpellInfo const* spell) { - case 0: - if (m_uiFerociousButtTimer <= diff) + if (spell->Id == SPELL_TRAMPLE && target->GetTypeId() == TYPEID_PLAYER) + { + if (!_trampleCasted) { - DoCastVictim(SPELL_FEROCIOUS_BUTT); - m_uiFerociousButtTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiFerociousButtTimer -= diff; + DoCast(me, SPELL_FROTHING_RAGE, true); + _trampleCasted = true; + } + } + } - if (m_uiArticBreathTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_ARCTIC_BREATH); - m_uiArticBreathTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else m_uiArticBreathTimer -= diff; + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; - if (m_uiWhirlTimer <= diff) - { - DoCastAOE(SPELL_WHIRL); - m_uiWhirlTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiWhirlTimer -= diff; + events.Update(diff); - if (m_uiMassiveCrashTimer <= diff) - { - me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room - SetCombatMovement(false); - me->AttackStop(); - m_uiStage = 7; //Invalid (Do nothing more than move) - m_uiMassiveCrashTimer = 30*IN_MILLISECONDS; - } else m_uiMassiveCrashTimer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - DoMeleeAttackIfReady(); - break; - case 1: - DoCastAOE(SPELL_MASSIVE_CRASH); - me->StopMoving(); - me->AttackStop(); - m_uiStage = 2; - break; - case 2: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) + switch (_stage) + { + case 0: { + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FEROCIOUS_BUTT: + DoCastVictim(SPELL_FEROCIOUS_BUTT); + events.ScheduleEvent(EVENT_FEROCIOUS_BUTT, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_ARCTIC_BREATH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + DoCast(target, SPELL_ARCTIC_BREATH); + return; + case EVENT_WHIRL: + DoCastAOE(SPELL_WHIRL); + events.ScheduleEvent(EVENT_WHIRL, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS)); + return; + case EVENT_MASSIVE_CRASH: + me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 20.0f, 20.0f); // 1: Middle of the room + SetCombatMovement(false); + me->AttackStop(); + _stage = 7; //Invalid (Do nothing more than move) + return; + default: + break; + } + } + DoMeleeAttackIfReady(); + break; + } + case 1: + DoCastAOE(SPELL_MASSIVE_CRASH); me->StopMoving(); me->AttackStop(); - m_uiTrampleTargetGUID = target->GetGUID(); - me->SetTarget(m_uiTrampleTargetGUID); - m_bTrampleCasted = false; - //SetCombatMovement(false); - //me->GetMotionMaster()->MoveIdle(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_uiTrampleTimer = 4*IN_MILLISECONDS; - m_uiStage = 3; - } else m_uiStage = 6; - break; - case 3: - me->StopMoving(); - me->AttackStop(); - if (m_uiTrampleTimer <= diff) - { - if (Unit* target = Unit::GetPlayer(*me, m_uiTrampleTargetGUID)) + _stage = 2; + break; + case 2: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) { - m_bTrampleCasted = false; - m_bMovementStarted = true; - m_fTrampleTargetX = target->GetPositionX(); - m_fTrampleTargetY = target->GetPositionY(); - m_fTrampleTargetZ = target->GetPositionZ(); - me->GetMotionMaster()->MoveJump(2*me->GetPositionX()-m_fTrampleTargetX, - 2*me->GetPositionY()-m_fTrampleTargetY, - me->GetPositionZ(), - 20.0f, 30.0f); // 2: Hop Backwards - m_uiStage = 7; //Invalid (Do nothing more than move) - } else m_uiStage = 6; - } else m_uiTrampleTimer -= diff; - break; - case 4: - me->StopMoving(); - me->AttackStop(); - Talk(EMOTE_TRAMPLE_START, m_uiTrampleTargetGUID); - me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1); - me->SetTarget(0); - m_uiStage = 5; - break; - case 5: - if (m_bMovementFinish) - { - if (m_uiTrampleTimer <= diff) DoCastAOE(SPELL_TRAMPLE); - m_bMovementFinish = false; - m_uiStage = 6; - return; - } - if (m_uiTrampleTimer <= diff) - { - Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) + me->StopMoving(); + me->AttackStop(); + _trampleTargetGUID = target->GetGUID(); + me->SetTarget(_trampleTargetGUID); + _trampleCasted = false; + SetCombatMovement(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + events.ScheduleEvent(EVENT_TRAMPLE, 4*IN_MILLISECONDS); + _stage = 3; + } + else + _stage = 6; + break; + case 3: + while (uint32 eventId = events.ExecuteEvent()) { - if (Unit* player = itr->getSource()) - if (player->isAlive() && player->IsWithinDistInMap(me, 6.0f)) + switch (eventId) + { + case EVENT_TRAMPLE: { - DoCastAOE(SPELL_TRAMPLE); - m_uiTrampleTimer = IN_MILLISECONDS; + if (Unit* target = Unit::GetPlayer(*me, _trampleTargetGUID)) + { + me->StopMoving(); + me->AttackStop(); + _trampleCasted = false; + _movementStarted = true; + _trampleTargetX = target->GetPositionX(); + _trampleTargetY = target->GetPositionY(); + _trampleTargetZ = target->GetPositionZ(); + // 2: Hop Backwards + me->GetMotionMaster()->MoveJump(2*me->GetPositionX() - _trampleTargetX, 2*me->GetPositionY() - _trampleTargetY, me->GetPositionZ(), 30.0f, 20.0f); + _stage = 7; //Invalid (Do nothing more than move) + } + else + _stage = 6; break; } + default: + break; + } } - } else m_uiTrampleTimer -= diff; - break; - case 6: - if (!m_bTrampleCasted) - { - DoCast(me, SPELL_STAGGERED_DAZE); - Talk(EMOTE_TRAMPLE_CRASH); - } - else - { - DoCast(me, SPELL_FROTHING_RAGE, true); - Talk(EMOTE_TRAMPLE_FAIL); - } - m_bMovementStarted = false; - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveChase(me->getVictim()); - SetCombatMovement(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_uiStage = 0; - break; + break; + case 4: + me->StopMoving(); + me->AttackStop(); + Talk(EMOTE_TRAMPLE_START, _trampleTargetGUID); + me->GetMotionMaster()->MoveCharge(_trampleTargetX, _trampleTargetY, _trampleTargetZ, 42, 1); + me->SetTarget(0); + _stage = 5; + break; + case 5: + if (_movementFinish) + { + DoCastAOE(SPELL_TRAMPLE); + _movementFinish = false; + _stage = 6; + return; + } + if (events.ExecuteEvent() == EVENT_TRAMPLE) + { + Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) + { + if (Unit* player = itr->getSource()) + { + if (player->isAlive() && player->IsWithinDistInMap(me, 6.0f)) + { + DoCastAOE(SPELL_TRAMPLE); + events.ScheduleEvent(EVENT_TRAMPLE, 4*IN_MILLISECONDS); + break; + } + } + } + } + break; + case 6: + if (!_trampleCasted) + { + DoCast(me, SPELL_STAGGERED_DAZE); + Talk(EMOTE_TRAMPLE_CRASH); + } + else + { + DoCast(me, SPELL_FROTHING_RAGE, true); + Talk(EMOTE_TRAMPLE_FAIL); + } + _movementStarted = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); + SetCombatMovement(true); + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveChase(me->getVictim()); + AttackStart(me->getVictim()); + events.ScheduleEvent(EVENT_MASSIVE_CRASH, 40*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_ARCTIC_BREATH, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS)); + _stage = 0; + break; + default: + break; + } } - } - }; + private: + float _trampleTargetX, _trampleTargetY, _trampleTargetZ; + uint64 _trampleTargetGUID; + bool _movementStarted; + bool _movementFinish; + bool _trampleCasted; + uint8 _stage; + Unit* _target; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_icehowlAI(creature); + } }; void AddSC_boss_northrend_beasts() { new boss_gormok(); new mob_snobold_vassal(); + new npc_firebomb(); + new spell_gormok_fire_bomb(); + new boss_acidmaw(); new boss_dreadscale(); new mob_slime_pool(); + new boss_icehowl(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index a65eaebbc0c..0c081da5204 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -16,13 +16,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: trial_of_the_crusader -SD%Complete: ??% -SDComment: based on /dev/rsa -SDCategory: Crusader Coliseum -EndScriptData */ - // Known bugs: // - They should be floating but they aren't respecting the floor =( // - Hardcoded bullets spawner @@ -48,13 +41,13 @@ enum Yells SAY_TWINK_PACT = 5, SAY_KILL_PLAYER = 6, SAY_BERSERK = 7, - SAY_DEATH = 8, + SAY_DEATH = 8 }; enum Equipment { EQUIP_MAIN_1 = 9423, - EQUIP_MAIN_2 = 37377, + EQUIP_MAIN_2 = 37377 }; enum Summons @@ -62,7 +55,7 @@ enum Summons NPC_BULLET_CONTROLLER = 34743, NPC_BULLET_DARK = 34628, - NPC_BULLET_LIGHT = 34630, + NPC_BULLET_LIGHT = 34630 }; enum BossSpells @@ -72,6 +65,7 @@ enum BossSpells SPELL_LIGHT_SHIELD = 65858, SPELL_LIGHT_TWIN_PACT = 65876, SPELL_LIGHT_VORTEX = 66046, + SPELL_LIGHT_VORTEX_DAMAGE = 66048, SPELL_LIGHT_TOUCH = 67297, SPELL_LIGHT_ESSENCE = 65686, SPELL_EMPOWERED_LIGHT = 65748, @@ -83,17 +77,18 @@ enum BossSpells SPELL_DARK_SHIELD = 65874, SPELL_DARK_TWIN_PACT = 65875, SPELL_DARK_VORTEX = 66058, + SPELL_DARK_VORTEX_DAMAGE = 66059, SPELL_DARK_TOUCH = 67282, SPELL_DARK_ESSENCE = 65684, SPELL_EMPOWERED_DARK = 65724, SPELL_TWIN_EMPATHY_DARK = 66132, SPELL_UNLEASHED_DARK = 65808, - SPELL_CONTROLLER_PERIODIC = 66149, + SPELL_CONTROLLER_PERIODIC = 66149, SPELL_POWER_TWINS = 65879, SPELL_BERSERK = 64238, SPELL_POWERING_UP = 67590, - SPELL_SURGE_OF_SPEED = 65828, + SPELL_SURGE_OF_SPEED = 65828 }; #define SPELL_DARK_ESSENCE_HELPER RAID_MODE<uint32>(65684, 67176, 67177, 67178) @@ -106,13 +101,12 @@ enum BossSpells enum Actions { - ACTION_VORTEX, - ACTION_PACT + ACTION_VORTEX = 0, + ACTION_PACT = 1 }; -/*###### -## boss_twin_base -######*/ +#define ESSENCE_REMOVE 0 +#define ESSENCE_APPLY 1 class OrbsDespawner : public BasicEvent { @@ -145,61 +139,36 @@ class OrbsDespawner : public BasicEvent Creature* _creature; }; -struct boss_twin_baseAI : public ScriptedAI +struct boss_twin_baseAI : public BossAI { - boss_twin_baseAI(Creature* creature) : ScriptedAI(creature), Summons(me) + boss_twin_baseAI(Creature* creature) : BossAI(creature, BOSS_VALKIRIES) { - instance = creature->GetInstanceScript(); } - InstanceScript* instance; - SummonList Summons; - - AuraStateType m_uiAuraState; - - uint8 m_uiStage; - bool m_bIsBerserk; - uint32 m_uiWeapon; - uint32 m_uiSpecialAbilityTimer; - uint32 m_uiSpikeTimer; - uint32 m_uiTouchTimer; - uint32 m_uiBerserkTimer; - - int32 m_uiVortexEmote; - uint32 m_uiSisterNpcId; - uint32 m_uiMyEmphatySpellId; - uint32 m_uiOtherEssenceSpellId; - uint32 m_uiSurgeSpellId; - uint32 m_uiVortexSpellId; - uint32 m_uiShieldSpellId; - uint32 m_uiTwinPactSpellId; - uint32 m_uiSpikeSpellId; - uint32 m_uiTouchSpellId; - void Reset() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); - me->ModifyAuraState(m_uiAuraState, true); - /* Uncomment this once that they are flying above the ground + me->ModifyAuraState(AuraState, true); + /* Uncomment this once that they are floating above the ground me->SetLevitate(true); me->SetFlying(true); */ - m_bIsBerserk = false; + IsBerserk = false; - m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS; - m_uiSpikeTimer = 20*IN_MILLISECONDS; - m_uiTouchTimer = urand(10, 15)*IN_MILLISECONDS; - m_uiBerserkTimer = IsHeroic() ? 6*MINUTE*IN_MILLISECONDS : 10*MINUTE*IN_MILLISECONDS; + SpecialAbilityTimer = 1*MINUTE*IN_MILLISECONDS; + SpikeTimer = 20*IN_MILLISECONDS; + TouchTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); + BerserkTimer = IsHeroic() ? 6*MINUTE*IN_MILLISECONDS : 10*MINUTE*IN_MILLISECONDS; - Summons.DespawnAll(); + summons.DespawnAll(); } void JustReachedHome() { if (instance) - instance->SetData(TYPE_VALKIRIES, FAIL); + instance->SetBossState(BOSS_VALKIRIES, FAIL); - Summons.DespawnAll(); + summons.DespawnAll(); me->DespawnOrUnsummon(); } @@ -211,10 +180,11 @@ struct boss_twin_baseAI : public ScriptedAI switch (uiId) { case 1: - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); break; + default: + break; } } @@ -230,7 +200,7 @@ struct boss_twin_baseAI : public ScriptedAI void JustSummoned(Creature* summoned) { - Summons.Summon(summoned); + summons.Summon(summoned); } void SummonedCreatureDespawn(Creature* summoned) @@ -248,8 +218,10 @@ struct boss_twin_baseAI : public ScriptedAI case NPC_BULLET_CONTROLLER: me->m_Events.AddEvent(new OrbsDespawner(me), me->m_Events.CalculateTime(100)); break; + default: + break; } - Summons.Despawn(summoned); + summons.Despawn(summoned); } void JustDied(Unit* /*killer*/) @@ -263,24 +235,22 @@ struct boss_twin_baseAI : public ScriptedAI { me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); pSister->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - - instance->SetData(TYPE_VALKIRIES, DONE); - Summons.DespawnAll(); + _JustDied(); } else { me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - instance->SetData(TYPE_VALKIRIES, SPECIAL); + instance->SetBossState(BOSS_VALKIRIES, SPECIAL); } } } - Summons.DespawnAll(); + summons.DespawnAll(); } // Called when sister pointer needed Creature* GetSister() { - return Unit::GetCreature((*me), instance->GetData64(m_uiSisterNpcId)); + return Unit::GetCreature((*me), instance->GetData64(SisterNpcId)); } void EnterCombat(Unit* /*who*/) @@ -290,14 +260,14 @@ struct boss_twin_baseAI : public ScriptedAI { if (Creature* pSister = GetSister()) { - me->AddAura(m_uiMyEmphatySpellId, pSister); + me->AddAura(MyEmphatySpellId, pSister); pSister->SetInCombatWithZone(); } - instance->SetData(TYPE_VALKIRIES, IN_PROGRESS); + instance->SetBossState(BOSS_VALKIRIES, IN_PROGRESS); } Talk(SAY_AGGRO); - DoCast(me, m_uiSurgeSpellId); + DoCast(me, SurgeSpellId); } void DoAction(const int32 action) @@ -305,45 +275,50 @@ struct boss_twin_baseAI : public ScriptedAI switch (action) { case ACTION_VORTEX: - m_uiStage = me->GetEntry() == NPC_LIGHTBANE ? 2 : 1; + Stage = me->GetEntry() == NPC_LIGHTBANE ? 2 : 1; break; case ACTION_PACT: - m_uiStage = me->GetEntry() == NPC_LIGHTBANE ? 1 : 2; + Stage = me->GetEntry() == NPC_LIGHTBANE ? 1 : 2; + break; + default: break; } } void EnableDualWield(bool mode = true) { - SetEquipmentSlots(false, m_uiWeapon, mode ? m_uiWeapon : int32(EQUIP_UNEQUIP), EQUIP_UNEQUIP); + SetEquipmentSlots(false, Weapon, mode ? Weapon : int32(EQUIP_UNEQUIP), EQUIP_UNEQUIP); me->SetCanDualWield(mode); me->UpdateDamagePhysical(mode ? OFF_ATTACK : BASE_ATTACK); } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(const uint32 diff) { if (!instance || !UpdateVictim()) return; - switch (m_uiStage) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + switch (Stage) { case 0: break; case 1: // Vortex - if (m_uiSpecialAbilityTimer <= uiDiff) + if (SpecialAbilityTimer <= diff) { if (Creature* pSister = GetSister()) pSister->AI()->DoAction(ACTION_VORTEX); - Talk(m_uiVortexEmote); - DoCastAOE(m_uiVortexSpellId); - m_uiStage = 0; - m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS; + Talk(VortexEmote); + DoCastAOE(VortexSpellId); + Stage = 0; + SpecialAbilityTimer = 1*MINUTE*IN_MILLISECONDS; } else - m_uiSpecialAbilityTimer -= uiDiff; + SpecialAbilityTimer -= diff; break; - case 2: // Shield+Pact - if (m_uiSpecialAbilityTimer <= uiDiff) + case 2: // Shield + Pact + if (SpecialAbilityTimer <= diff) { Talk(EMOTE_TWINK_PACT); Talk(SAY_TWINK_PACT); @@ -352,164 +327,169 @@ struct boss_twin_baseAI : public ScriptedAI pSister->AI()->DoAction(ACTION_PACT); pSister->CastSpell(pSister, SPELL_POWER_TWINS, false); } - DoCast(me, m_uiShieldSpellId); - DoCast(me, m_uiTwinPactSpellId); - m_uiStage = 0; - m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS; + DoCast(me, ShieldSpellId); + DoCast(me, TwinPactSpellId); + Stage = 0; + SpecialAbilityTimer = 1*MINUTE*IN_MILLISECONDS; } else - m_uiSpecialAbilityTimer -= uiDiff; + SpecialAbilityTimer -= diff; break; default: break; } - if (m_uiSpikeTimer <= uiDiff) + if (SpikeTimer <= diff) { - DoCastVictim(m_uiSpikeSpellId); - m_uiSpikeTimer = 20*IN_MILLISECONDS; + DoCastVictim(SpikeSpellId); + SpikeTimer = 20*IN_MILLISECONDS; } else - m_uiSpikeTimer -= uiDiff; + SpikeTimer -= diff; - if (IsHeroic() && m_uiTouchTimer <= uiDiff) + if (IsHeroic() && TouchTimer <= diff) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true, m_uiOtherEssenceSpellId)) - me->CastCustomSpell(m_uiTouchSpellId, SPELLVALUE_MAX_TARGETS, 1, target, false); - m_uiTouchTimer = urand(10, 15)*IN_MILLISECONDS; + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true, OtherEssenceSpellId)) + me->CastCustomSpell(TouchSpellId, SPELLVALUE_MAX_TARGETS, 1, target, false); + TouchTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); } else - m_uiTouchTimer -= uiDiff; + TouchTimer -= diff; - if (!m_bIsBerserk && m_uiBerserkTimer <= uiDiff) + if (!IsBerserk && BerserkTimer <= diff) { DoCast(me, SPELL_BERSERK); Talk(SAY_BERSERK); - m_bIsBerserk = true; + IsBerserk = true; } else - m_uiBerserkTimer -= uiDiff; + BerserkTimer -= diff; DoMeleeAttackIfReady(); } -}; -/*###### -## boss_fjola -######*/ + protected: + AuraStateType AuraState; + + uint8 Stage; + bool IsBerserk; + + uint32 Weapon; + uint32 SpecialAbilityTimer; + uint32 SpikeTimer; + uint32 TouchTimer; + uint32 BerserkTimer; + + int32 VortexEmote; + uint32 SisterNpcId; + uint32 MyEmphatySpellId; + uint32 OtherEssenceSpellId; + uint32 SurgeSpellId; + uint32 VortexSpellId; + uint32 ShieldSpellId; + uint32 TwinPactSpellId; + uint32 SpikeSpellId; + uint32 TouchSpellId; +}; class boss_fjola : public CreatureScript { -public: - boss_fjola() : CreatureScript("boss_fjola") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new boss_fjolaAI(creature); - } + public: + boss_fjola() : CreatureScript("boss_fjola") { } - struct boss_fjolaAI : public boss_twin_baseAI - { - boss_fjolaAI(Creature* creature) : boss_twin_baseAI(creature) + struct boss_fjolaAI : public boss_twin_baseAI { - instance = creature->GetInstanceScript(); - } + boss_fjolaAI(Creature* creature) : boss_twin_baseAI(creature) + { + } - InstanceScript* instance; - - void Reset() { - boss_twin_baseAI::Reset(); - SetEquipmentSlots(false, EQUIP_MAIN_1, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - m_uiStage = 0; - m_uiWeapon = EQUIP_MAIN_1; - m_uiAuraState = AURA_STATE_UNKNOWN22; - m_uiVortexEmote = EMOTE_VORTEX; - m_uiSisterNpcId = NPC_DARKBANE; - m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK; - m_uiOtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER; - m_uiSurgeSpellId = SPELL_LIGHT_SURGE; - m_uiVortexSpellId = SPELL_LIGHT_VORTEX; - m_uiShieldSpellId = SPELL_LIGHT_SHIELD; - m_uiTwinPactSpellId = SPELL_LIGHT_TWIN_PACT; - m_uiTouchSpellId = SPELL_LIGHT_TOUCH; - m_uiSpikeSpellId = SPELL_LIGHT_TWIN_SPIKE; + void Reset() + { + SetEquipmentSlots(false, EQUIP_MAIN_1, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + Stage = 0; + Weapon = EQUIP_MAIN_1; + AuraState = AURA_STATE_UNKNOWN22; + VortexEmote = EMOTE_VORTEX; + SisterNpcId = NPC_DARKBANE; + MyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK; + OtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER; + SurgeSpellId = SPELL_LIGHT_SURGE; + VortexSpellId = SPELL_LIGHT_VORTEX; + ShieldSpellId = SPELL_LIGHT_SHIELD; + TwinPactSpellId = SPELL_LIGHT_TWIN_PACT; + TouchSpellId = SPELL_LIGHT_TOUCH; + SpikeSpellId = SPELL_LIGHT_TWIN_SPIKE; + + if (instance) + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); + boss_twin_baseAI::Reset(); + } - if (instance) + void EnterCombat(Unit* who) { - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); + + me->SummonCreature(NPC_BULLET_CONTROLLER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN); + boss_twin_baseAI::EnterCombat(who); } - } - void EnterCombat(Unit* who) - { - if (instance) + void EnterEvadeMode() { - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + boss_twin_baseAI::EnterEvadeMode(); } - me->SummonCreature(NPC_BULLET_CONTROLLER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN); - boss_twin_baseAI::EnterCombat(who); - } + void JustReachedHome() + { + if (instance) + instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - void EnterEvadeMode() - { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - boss_twin_baseAI::EnterEvadeMode(); - } + boss_twin_baseAI::JustReachedHome(); + } + }; - void JustReachedHome() + CreatureAI* GetAI(Creature* creature) const { - if (instance) - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - - boss_twin_baseAI::JustReachedHome(); + return new boss_fjolaAI(creature); } - }; - }; -/*###### -## boss_eydis -######*/ - class boss_eydis : public CreatureScript { -public: - boss_eydis() : CreatureScript("boss_eydis") { } + public: + boss_eydis() : CreatureScript("boss_eydis") { } - CreatureAI* GetAI(Creature* creature) const - { - return new boss_eydisAI(creature); - } + struct boss_eydisAI : public boss_twin_baseAI + { + boss_eydisAI(Creature* creature) : boss_twin_baseAI(creature) {} - struct boss_eydisAI : public boss_twin_baseAI - { - boss_eydisAI(Creature* creature) : boss_twin_baseAI(creature) {} - - void Reset() { - boss_twin_baseAI::Reset(); - SetEquipmentSlots(false, EQUIP_MAIN_2, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - m_uiStage = 1; - m_uiWeapon = EQUIP_MAIN_2; - m_uiAuraState = AURA_STATE_UNKNOWN19; - m_uiVortexEmote = EMOTE_VORTEX; - m_uiSisterNpcId = NPC_LIGHTBANE; - m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT; - m_uiOtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER; - m_uiSurgeSpellId = SPELL_DARK_SURGE; - m_uiVortexSpellId = SPELL_DARK_VORTEX; - m_uiShieldSpellId = SPELL_DARK_SHIELD; - m_uiTwinPactSpellId = SPELL_DARK_TWIN_PACT; - m_uiTouchSpellId = SPELL_DARK_TOUCH; - m_uiSpikeSpellId = SPELL_DARK_TWIN_SPIKE; - } - }; + void Reset() + { + SetEquipmentSlots(false, EQUIP_MAIN_2, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + Stage = 1; + Weapon = EQUIP_MAIN_2; + AuraState = AURA_STATE_UNKNOWN19; + VortexEmote = EMOTE_VORTEX; + SisterNpcId = NPC_LIGHTBANE; + MyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT; + OtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER; + SurgeSpellId = SPELL_DARK_SURGE; + VortexSpellId = SPELL_DARK_VORTEX; + ShieldSpellId = SPELL_DARK_SHIELD; + TwinPactSpellId = SPELL_DARK_TWIN_PACT; + TouchSpellId = SPELL_DARK_TOUCH; + SpikeSpellId = SPELL_DARK_TWIN_SPIKE; + boss_twin_baseAI::Reset(); + } + }; + CreatureAI* GetAI(Creature* creature) const + { + return new boss_eydisAI(creature); + } }; -#define ESSENCE_REMOVE 0 -#define ESSENCE_APPLY 1 - class mob_essence_of_twin : public CreatureScript { public: @@ -519,16 +499,16 @@ class mob_essence_of_twin : public CreatureScript { mob_essence_of_twinAI(Creature* creature) : ScriptedAI(creature) { } - uint32 GetData(uint32 data) + uint32 GetData(uint32 data) const { uint32 spellReturned = 0; switch (me->GetEntry()) { case NPC_LIGHT_ESSENCE: - spellReturned = data == ESSENCE_REMOVE? SPELL_DARK_ESSENCE_HELPER : SPELL_LIGHT_ESSENCE_HELPER; + spellReturned = (data == ESSENCE_REMOVE) ? SPELL_DARK_ESSENCE_HELPER : SPELL_LIGHT_ESSENCE_HELPER; break; case NPC_DARK_ESSENCE: - spellReturned = data == ESSENCE_REMOVE? SPELL_LIGHT_ESSENCE_HELPER : SPELL_DARK_ESSENCE_HELPER; + spellReturned = (data == ESSENCE_REMOVE) ? SPELL_LIGHT_ESSENCE_HELPER : SPELL_DARK_ESSENCE_HELPER; break; default: break; @@ -556,12 +536,8 @@ struct mob_unleashed_ballAI : public ScriptedAI { mob_unleashed_ballAI(Creature* creature) : ScriptedAI(creature) { - instance = creature->GetInstanceScript(); } - InstanceScript* instance; - uint32 m_uiRangeCheckTimer; - void MoveToNextPoint() { float x0 = ToCCommonLoc[1].GetPositionX(), y0 = ToCCommonLoc[1].GetPositionY(), r = 47.0f; @@ -578,13 +554,13 @@ struct mob_unleashed_ballAI : public ScriptedAI void Reset() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); me->SetDisableGravity(true); me->SetCanFly(true); SetCombatMovement(false); MoveToNextPoint(); - m_uiRangeCheckTimer = IN_MILLISECONDS; + RangeCheckTimer = 0.5*IN_MILLISECONDS; } void MovementInform(uint32 uiType, uint32 uiId) @@ -600,160 +576,112 @@ struct mob_unleashed_ballAI : public ScriptedAI else me->DisappearAndDie(); break; + default: + break; } } + + protected: + uint32 RangeCheckTimer; }; class mob_unleashed_dark : public CreatureScript { -public: - mob_unleashed_dark() : CreatureScript("mob_unleashed_dark") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_unleashed_darkAI(creature); - } - - struct mob_unleashed_darkAI : public mob_unleashed_ballAI - { - mob_unleashed_darkAI(Creature* creature) : mob_unleashed_ballAI(creature) {} + public: + mob_unleashed_dark() : CreatureScript("mob_unleashed_dark") { } - void UpdateAI(const uint32 uiDiff) + struct mob_unleashed_darkAI : public mob_unleashed_ballAI { - if (m_uiRangeCheckTimer < uiDiff) + mob_unleashed_darkAI(Creature* creature) : mob_unleashed_ballAI(creature) {} + + void UpdateAI(const uint32 diff) { - if (me->SelectNearestPlayer(2.0f)) + if (RangeCheckTimer < diff) + { + if (me->SelectNearestPlayer(3.0f)) { - DoCastAOE(SPELL_UNLEASHED_DARK); + DoCastAOE(SPELL_UNLEASHED_DARK_HELPER); me->GetMotionMaster()->MoveIdle(); - me->DespawnOrUnsummon(500); + me->DespawnOrUnsummon(1*IN_MILLISECONDS); } - m_uiRangeCheckTimer = IN_MILLISECONDS; + RangeCheckTimer = 0.5*IN_MILLISECONDS; + } + else + RangeCheckTimer -= diff; } - else m_uiRangeCheckTimer -= uiDiff; - } + }; - void SpellHitTarget(Unit* who, SpellInfo const* spell) + CreatureAI* GetAI(Creature* creature) const { - if (spell->Id == SPELL_UNLEASHED_DARK_HELPER) - { - if (who->HasAura(SPELL_DARK_ESSENCE_HELPER)) - who->CastSpell(who, SPELL_POWERING_UP, true); - } + return new mob_unleashed_darkAI(creature); } - }; - }; class mob_unleashed_light : public CreatureScript { -public: - mob_unleashed_light() : CreatureScript("mob_unleashed_light") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_unleashed_lightAI(creature); - } - - struct mob_unleashed_lightAI : public mob_unleashed_ballAI - { - mob_unleashed_lightAI(Creature* creature) : mob_unleashed_ballAI(creature) {} + public: + mob_unleashed_light() : CreatureScript("mob_unleashed_light") { } - void UpdateAI(const uint32 uiDiff) + struct mob_unleashed_lightAI : public mob_unleashed_ballAI { - if (m_uiRangeCheckTimer < uiDiff) + mob_unleashed_lightAI(Creature* creature) : mob_unleashed_ballAI(creature) {} + + void UpdateAI(const uint32 diff) { - if (me->SelectNearestPlayer(2.0f)) + if (RangeCheckTimer < diff) + { + if (me->SelectNearestPlayer(3.0f)) { - DoCastAOE(SPELL_UNLEASHED_LIGHT); + DoCastAOE(SPELL_UNLEASHED_LIGHT_HELPER); me->GetMotionMaster()->MoveIdle(); - me->DespawnOrUnsummon(500); + me->DespawnOrUnsummon(1*IN_MILLISECONDS); } - m_uiRangeCheckTimer = IN_MILLISECONDS; + RangeCheckTimer = 0.5*IN_MILLISECONDS; + } + else + RangeCheckTimer -= diff; } - else m_uiRangeCheckTimer -= uiDiff; - } + }; - void SpellHitTarget(Unit* who, SpellInfo const* spell) + CreatureAI* GetAI(Creature* creature) const { - if (spell->Id == SPELL_UNLEASHED_LIGHT_HELPER) - { - if (who->HasAura(SPELL_LIGHT_ESSENCE_HELPER)) - who->CastSpell(who, SPELL_POWERING_UP, true); - } + return new mob_unleashed_lightAI(creature); } - }; - }; class mob_bullet_controller : public CreatureScript { -public: - mob_bullet_controller() : CreatureScript("mob_bullet_controller") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_bullet_controllerAI(creature); - } - - struct mob_bullet_controllerAI : public Scripted_NoMovementAI - { - mob_bullet_controllerAI(Creature* creature) : Scripted_NoMovementAI(creature) - { - Reset(); - } - - void Reset() - { - DoCastAOE(SPELL_CONTROLLER_PERIODIC); - } - - void UpdateAI(const uint32 /*uiDiff*/) - { - UpdateVictim(); - } - }; -}; - -class spell_powering_up : public SpellScriptLoader -{ public: - spell_powering_up() : SpellScriptLoader("spell_powering_up") { } + mob_bullet_controller() : CreatureScript("mob_bullet_controller") { } - class spell_powering_up_AuraScript : public AuraScript + struct mob_bullet_controllerAI : public Scripted_NoMovementAI { - PrepareAuraScript(spell_powering_up_AuraScript); - - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + mob_bullet_controllerAI(Creature* creature) : Scripted_NoMovementAI(creature) { - if (Unit* target = GetTarget()) - { - if (Aura* pAura = target->GetAura(GetId())) - { - if (pAura->GetStackAmount() == 100) - { - if (target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2206, EFFECT_1)) - target->CastSpell(target, SPELL_EMPOWERED_DARK, true); - - if (target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2845, EFFECT_1)) - target->CastSpell(target, SPELL_EMPOWERED_LIGHT, true); + Reset(); + } - target->RemoveAurasDueToSpell(GetId()); - } - } - } + void Reset() + { + DoCastAOE(SPELL_CONTROLLER_PERIODIC); } - void Register() + void UpdateAI(const uint32 /*diff*/) { - OnEffectApply += AuraEffectApplyFn(spell_powering_up_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + UpdateVictim(); } }; - AuraScript* GetAuraScript() const + CreatureAI* GetAI(Creature* creature) const { - return new spell_powering_up_AuraScript(); + return new mob_bullet_controllerAI(creature); } +}; + +class spell_powering_up : public SpellScriptLoader +{ + public: + spell_powering_up() : SpellScriptLoader("spell_powering_up") { } class spell_powering_up_SpellScript : public SpellScript { @@ -761,20 +689,39 @@ class spell_powering_up : public SpellScriptLoader PrepareSpellScript(spell_powering_up_SpellScript) uint32 spellId; + uint32 poweringUp; bool Load() { spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster()); if (!sSpellMgr->GetSpellInfo(spellId)) return false; + + poweringUp = sSpellMgr->GetSpellIdForDifficulty(SPELL_POWERING_UP, GetCaster()); + if (!sSpellMgr->GetSpellInfo(poweringUp)) + return false; + return true; } void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetExplTargetUnit()) - if (urand(0, 99) < 15) - target->CastSpell(target, spellId, true); + if (Unit* target = GetHitUnit()) + { + if (Aura* pAura = target->GetAura(poweringUp)) + { + if (pAura->GetStackAmount() >= 100) + { + if (target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2206, EFFECT_1)) + target->CastSpell(target, SPELL_EMPOWERED_DARK, true); + + if (target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2845, EFFECT_1)) + target->CastSpell(target, SPELL_EMPOWERED_LIGHT, true); + + target->RemoveAurasDueToSpell(poweringUp); + } + } + } } void Register() @@ -808,10 +755,68 @@ class spell_valkyr_essences : public SpellScriptLoader return true; } - void Absorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & /*absorbAmount*/) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & /*absorbAmount*/) { - if (urand(0, 99) < 5) - GetTarget()->CastSpell(GetTarget(), spellId, true); + if (Unit* owner = GetUnitOwner()) + { + if (dmgInfo.GetSpellInfo()) + { + if (uint32 poweringUp = sSpellMgr->GetSpellIdForDifficulty(SPELL_POWERING_UP, owner)) + { + if (urand(0, 99) < 5) + GetTarget()->CastSpell(GetTarget(), spellId, true); + + // Twin Vortex part + uint32 lightVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHT_VORTEX_DAMAGE, owner); + uint32 darkVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_DARK_VORTEX_DAMAGE, owner); + int32 stacksCount = int32(dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue()) * 0.001 - 1; + + if (lightVortex && darkVortex && stacksCount) + { + if (dmgInfo.GetSpellInfo()->Id == darkVortex || dmgInfo.GetSpellInfo()->Id == lightVortex) + { + Aura* pAura = owner->GetAura(poweringUp); + if (pAura) + { + pAura->ModStackAmount(stacksCount); + owner->CastSpell(owner, poweringUp, true); + } + else + { + owner->CastSpell(owner, poweringUp, true); + if (Aura* pTemp = owner->GetAura(poweringUp)) + pTemp->ModStackAmount(stacksCount); + } + } + } + + // Picking floating balls + uint32 unleashedDark = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_DARK, owner); + uint32 unleashedLight = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_LIGHT, owner); + + if (unleashedDark && unleashedLight) + { + if (dmgInfo.GetSpellInfo()->Id == unleashedDark || dmgInfo.GetSpellInfo()->Id == unleashedLight) + { + // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening + Aura* pAura = owner->GetAura(poweringUp); + if (pAura) + { + // 2 lines together add the correct amount of buff stacks + pAura->ModStackAmount(stacksCount); + owner->CastSpell(owner, poweringUp, true); + } + else + { + owner->CastSpell(owner, poweringUp, true); + if (Aura* pTemp = owner->GetAura(poweringUp)) + pTemp->ModStackAmount(stacksCount); + } + } + } + } + } + } } void Register() @@ -880,6 +885,7 @@ void AddSC_boss_twin_valkyr() new mob_unleashed_dark(); new mob_essence_of_twin(); new mob_bullet_controller(); + new spell_powering_up(); new spell_valkyr_essences(); new spell_power_of_the_twins(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index af6104008ff..6623d8e8765 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -16,16 +16,11 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: instance_trial_of_the_crusader -SD%Complete: 80% -SDComment: by /dev/rsa -SDCategory: Trial of the Crusader -EndScriptData */ - #include "ScriptMgr.h" #include "InstanceScript.h" #include "trial_of_the_crusader.h" +#include "Player.h" +#include "TemporarySummon.h" class instance_trial_of_the_crusader : public InstanceMapScript { @@ -36,82 +31,54 @@ class instance_trial_of_the_crusader : public InstanceMapScript { instance_trial_of_the_crusader_InstanceMapScript(Map* map) : InstanceScript(map) {} - uint32 EncounterStatus[MAX_ENCOUNTERS]; - uint32 TrialCounter; - uint32 EventStage; - uint32 EventTimer; - uint32 EventNPCId; - uint32 NorthrendBeasts; - std::string SaveDataBuffer; - bool NeedSave; - - uint64 BarrentGUID; - uint64 TirionGUID; - uint64 TirionFordringGUID; - uint64 FizzlebangGUID; - uint64 GarroshGUID; - uint64 VarianGUID; - - uint64 GormokGUID; - uint64 AcidmawGUID; - uint64 DreadscaleGUID; - uint64 IcehowlGUID; - uint64 JaraxxusGUID; - uint64 ChampionsControllerGUID; - uint64 DarkbaneGUID; - uint64 LightbaneGUID; - uint64 AnubarakGUID; - - uint64 CrusadersCacheGUID; - uint64 FloorGUID; - - uint64 TributeChestGUID; - - uint64 MainGateDoorGUID; - uint64 EastPortcullisGUID; - uint64 WebDoorGUID; - - // Achievement stuff - uint32 NotOneButTwoJormungarsTimer; - uint32 ResilienceWillFixItTimer; - uint8 SnoboldCount; - uint8 MistressOfPainCount; - bool TributeToImmortalityElegible; - void Initialize() { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - EncounterStatus[i] = NOT_STARTED; - + SetBossNumber(MAX_ENCOUNTERS); TrialCounter = 50; EventStage = 0; - - TirionFordringGUID = 0; - - TributeChestGUID = 0; - - MainGateDoorGUID = 0; - EastPortcullisGUID = 0; - WebDoorGUID = 0; - NorthrendBeasts = NOT_STARTED; - EventTimer = 1000; - NotOneButTwoJormungarsTimer = 0; ResilienceWillFixItTimer = 0; SnoboldCount = 0; MistressOfPainCount = 0; TributeToImmortalityElegible = true; - NeedSave = false; + + TirionFordringGUID = 0; + BarrentGUID = 0; + TirionGUID = 0; + FizzlebangGUID = 0; + GarroshGUID = 0; + VarianGUID = 0; + GormokGUID = 0; + AcidmawGUID = 0; + DreadscaleGUID = 0; + IcehowlGUID = 0; + JaraxxusGUID = 0; + ChampionsControllerGUID = 0; + DarkbaneGUID = 0; + LightbaneGUID = 0; + AnubarakGUID = 0; + + TributeChestGUID = 0; + MainGateDoorGUID = 0; + EastPortcullisGUID = 0; + WebDoorGUID = 0; + CrusadersCacheGUID = 0; + FloorGUID = 0; } bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - if (EncounterStatus[i] == IN_PROGRESS) + if (GetBossState(i) == IN_PROGRESS) return true; + + // Special state is set at Faction Champions after first champ dead, encounter is still in combat + if (GetBossState(BOSS_CRUSADERS) == SPECIAL) + return true; + return false; } @@ -122,12 +89,26 @@ class instance_trial_of_the_crusader : public InstanceMapScript player->SendUpdateWorldState(UPDATE_STATE_UI_SHOW, 1); player->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, GetData(TYPE_COUNTER)); } + else + player->SendUpdateWorldState(UPDATE_STATE_UI_SHOW, 0); + + // make sure Anub'arak isnt missing and floor is destroyed after a crash + if (GetBossState(BOSS_LICH_KING) == DONE && TrialCounter && GetBossState(BOSS_ANUBARAK) != DONE) + { + Creature* anubArak = Unit::GetCreature(*player, GetData64(NPC_ANUBARAK)); + if (!anubArak) + anubArak = player->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); + + if (GameObject* floor = GameObject::GetGameObject(*player, GetData64(GO_ARGENT_COLISEUM_FLOOR))) + floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); + } } void OpenDoor(uint64 guid) { if (!guid) return; + if (GameObject* go = instance->GetGameObject(guid)) go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); } @@ -136,6 +117,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript { if (!guid) return; + if (GameObject* go = instance->GetGameObject(guid)) go->SetGoState(GO_STATE_READY); } @@ -146,6 +128,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript { case NPC_BARRENT: BarrentGUID = creature->GetGUID(); + if (!TrialCounter) + creature->DespawnOrUnsummon(); break; case NPC_TIRION: TirionGUID = creature->GetGUID(); @@ -190,6 +174,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript case NPC_ANUBARAK: AnubarakGUID = creature->GetGUID(); break; + default: + break; } } @@ -236,34 +222,41 @@ class instance_trial_of_the_crusader : public InstanceMapScript case GO_TRIBUTE_CHEST_25H_99: TributeChestGUID = go->GetGUID(); break; + default: + break; } } - void SetData(uint32 type, uint32 data) + bool SetBossState(uint32 type, EncounterState state) { + if (!InstanceScript::SetBossState(type, state)) + return false; + switch (type) { - case TYPE_JARAXXUS: + case BOSS_BEASTS: + break; + case BOSS_JARAXXUS: // Cleanup Icehowl if (Creature* icehowl = instance->GetCreature(IcehowlGUID)) icehowl->DespawnOrUnsummon(); - if (data == DONE) + if (state == DONE) EventStage = 2000; break; - case TYPE_CRUSADERS: + case BOSS_CRUSADERS: // Cleanup Jaraxxus if (Creature* jaraxxus = instance->GetCreature(JaraxxusGUID)) jaraxxus->DespawnOrUnsummon(); if (Creature* fizzlebang = instance->GetCreature(FizzlebangGUID)) fizzlebang->DespawnOrUnsummon(); - switch (data) + switch (state) { case IN_PROGRESS: ResilienceWillFixItTimer = 0; break; case SPECIAL: //Means the first blood ResilienceWillFixItTimer = 60*IN_MILLISECONDS; - data = IN_PROGRESS; + state = IN_PROGRESS; break; case DONE: DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DEFEAT_FACTION_CHAMPIONS); @@ -272,21 +265,23 @@ class instance_trial_of_the_crusader : public InstanceMapScript DoRespawnGameObject(CrusadersCacheGUID, 7*DAY); EventStage = 3100; break; + default: + break; } break; - case TYPE_VALKIRIES: + case BOSS_VALKIRIES: // Cleanup chest if (GameObject* cache = instance->GetGameObject(CrusadersCacheGUID)) cache->Delete(); - switch (data) + switch (state) { case FAIL: - if (EncounterStatus[TYPE_VALKIRIES] == NOT_STARTED) - data = NOT_STARTED; + if (GetBossState(BOSS_VALKIRIES) == NOT_STARTED) + state = NOT_STARTED; break; case SPECIAL: - if (EncounterStatus[TYPE_VALKIRIES] == SPECIAL) - data = DONE; + if (GetBossState(BOSS_VALKIRIES) == SPECIAL) + state = DONE; break; case DONE: if (instance->GetPlayers().getFirst()->getSource()->GetTeam() == ALLIANCE) @@ -294,50 +289,122 @@ class instance_trial_of_the_crusader : public InstanceMapScript else EventStage = 4030; break; + default: + break; } break; - case TYPE_ANUBARAK: - switch (data) + case BOSS_LICH_KING: + break; + case BOSS_ANUBARAK: + switch (state) { case DONE: + { EventStage = 6000; - break; - case SPECIAL: uint32 tributeChest = 0; if (instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC) { if (TrialCounter >= 50) tributeChest = GO_TRIBUTE_CHEST_10H_99; else + { if (TrialCounter >= 45) tributeChest = GO_TRIBUTE_CHEST_10H_50; else + { if (TrialCounter >= 25) tributeChest = GO_TRIBUTE_CHEST_10H_45; else tributeChest = GO_TRIBUTE_CHEST_10H_25; + } + } } else if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC) { if (TrialCounter >= 50) tributeChest = GO_TRIBUTE_CHEST_25H_99; else + { if (TrialCounter >= 45) tributeChest = GO_TRIBUTE_CHEST_25H_50; else + { if (TrialCounter >= 25) tributeChest = GO_TRIBUTE_CHEST_25H_45; else tributeChest = GO_TRIBUTE_CHEST_25H_25; + } + } } + if (tributeChest) if (Creature* tirion = instance->GetCreature(TirionGUID)) - // need proper location.this one is guessed based on videos - if (GameObject* chest = tirion->SummonGameObject(tributeChest, 643.814f, 136.027f, 141.295f, 0, 0, 0, 0, 0, 90000000)) + if (GameObject* chest = tirion->SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, 0, 0, 0, 0, WEEK)) chest->SetRespawnTime(chest->GetRespawnDelay()); break; + } + default: + break; } break; + default: + break; + } + + if (IsEncounterInProgress()) + { + CloseDoor(GetData64(GO_EAST_PORTCULLIS)); + CloseDoor(GetData64(GO_WEB_DOOR)); + } + else + { + OpenDoor(GetData64(GO_EAST_PORTCULLIS)); + OpenDoor(GetData64(GO_WEB_DOOR)); + } + + if (type < MAX_ENCOUNTERS) + { + sLog->outInfo(LOG_FILTER_TSCR, "[ToCr] BossState(type %u) %u = state %u;", type, GetBossState(type), state); + if (state == FAIL) + { + if (instance->IsHeroic()) + { + --TrialCounter; + // decrease attempt counter at wipe + Map::PlayerList const &PlayerList = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + if (Player* player = itr->getSource()) + player->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, TrialCounter); + + // if theres no more attemps allowed + if (!TrialCounter) + { + if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT))) + announcer->ToCreature()->DespawnOrUnsummon(); + + if (Creature* anubArak = instance->GetCreature(GetData64(NPC_ANUBARAK))) + anubArak->DespawnOrUnsummon(); + } + } + NeedSave = true; + EventStage = (type == BOSS_BEASTS ? 666 : 0); + state = NOT_STARTED; + } + + if (state == DONE || NeedSave) + { + if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT))) + announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + Save(); + } + } + return true; + } + + void SetData(uint32 type, uint32 data) + { + switch (type) + { case TYPE_COUNTER: TrialCounter = data; data = DONE; @@ -357,7 +424,6 @@ class instance_trial_of_the_crusader : public InstanceMapScript case GORMOK_DONE: EventStage = 200; SetData(TYPE_NORTHREND_BEASTS, IN_PROGRESS); - SetData(TYPE_BEASTS, IN_PROGRESS); break; case SNAKES_IN_PROGRESS: NotOneButTwoJormungarsTimer = 0; @@ -370,15 +436,16 @@ class instance_trial_of_the_crusader : public InstanceMapScript DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_WORMS_KILLED_IN_10_SECONDS); EventStage = 300; SetData(TYPE_NORTHREND_BEASTS, IN_PROGRESS); - SetData(TYPE_BEASTS, IN_PROGRESS); break; case ICEHOWL_DONE: EventStage = 400; SetData(TYPE_NORTHREND_BEASTS, DONE); - SetData(TYPE_BEASTS, DONE); + SetBossState(BOSS_BEASTS, DONE); break; case FAIL: - SetData(TYPE_BEASTS, FAIL); + SetBossState(BOSS_BEASTS, FAIL); + break; + default: break; } break; @@ -398,41 +465,12 @@ class instance_trial_of_the_crusader : public InstanceMapScript case DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE: TributeToImmortalityElegible = false; break; - } - if (IsEncounterInProgress()) - { - CloseDoor(GetData64(GO_EAST_PORTCULLIS)); - CloseDoor(GetData64(GO_WEB_DOOR)); - } - else - { - OpenDoor(GetData64(GO_EAST_PORTCULLIS)); - OpenDoor(GetData64(GO_WEB_DOOR)); - } - - if (type < MAX_ENCOUNTERS) - { - sLog->outInfo(LOG_FILTER_TSCR, "[ToCr] EncounterStatus[type %u] %u = data %u;", type, EncounterStatus[type], data); - if (data == FAIL) - { - --TrialCounter; - NeedSave = true; - EventStage = (type == TYPE_BEASTS ? 666 : 0); - data = NOT_STARTED; - } - - EncounterStatus[type] = data; - - if (data == DONE || NeedSave == true) - { - if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT))) - announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - Save(); - } + default: + break; } } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { @@ -483,22 +521,10 @@ class instance_trial_of_the_crusader : public InstanceMapScript return 0; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { - case TYPE_BEASTS: - return EncounterStatus[TYPE_BEASTS]; - case TYPE_JARAXXUS: - return EncounterStatus[TYPE_JARAXXUS]; - case TYPE_CRUSADERS: - return EncounterStatus[TYPE_CRUSADERS]; - case TYPE_VALKIRIES: - return EncounterStatus[TYPE_VALKIRIES]; - case TYPE_LICH_KING: - return EncounterStatus[TYPE_LICH_KING]; - case TYPE_ANUBARAK: - return EncounterStatus[TYPE_ANUBARAK]; case TYPE_COUNTER: return TrialCounter; case TYPE_EVENT: @@ -549,7 +575,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript case 6000: case 6005: case 6010: - EventNPCId = NPC_TIRION; + return NPC_TIRION; break; case 5010: case 5030: @@ -558,7 +584,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript case 5060: case 5070: case 5080: - EventNPCId = NPC_LICH_KING_1; + return NPC_LICH_KING_1; break; case 120: case 122: @@ -567,7 +593,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript case 3051: case 3071: case 4020: - EventNPCId = NPC_VARIAN; + return NPC_VARIAN; break; case 130: case 132: @@ -576,7 +602,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript case 3070: case 3081: case 4030: - EventNPCId = NPC_GARROSH; + return NPC_GARROSH; break; case 1110: case 1120: @@ -588,13 +614,12 @@ class instance_trial_of_the_crusader : public InstanceMapScript case 1142: case 1144: case 1150: - EventNPCId = NPC_FIZZLEBANG; + return NPC_FIZZLEBANG; break; default: - EventNPCId = NPC_TIRION; + return NPC_TIRION; break; }; - return EventNPCId; default: break; } @@ -612,7 +637,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript NotOneButTwoJormungarsTimer -= diff; } - if (GetData(TYPE_CRUSADERS) == IN_PROGRESS && ResilienceWillFixItTimer) + if (GetBossState(BOSS_CRUSADERS) == SPECIAL && ResilienceWillFixItTimer) { if (ResilienceWillFixItTimer <= diff) ResilienceWillFixItTimer = 0; @@ -628,7 +653,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript std::ostringstream saveStream; for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - saveStream << EncounterStatus[i] << ' '; + saveStream << GetBossState(i) << ' '; saveStream << TrialCounter; SaveDataBuffer = saveStream.str(); @@ -657,10 +682,11 @@ class instance_trial_of_the_crusader : public InstanceMapScript for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) { - loadStream >> EncounterStatus[i]; - - if (EncounterStatus[i] == IN_PROGRESS) - EncounterStatus[i] = NOT_STARTED; + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); } loadStream >> TrialCounter; @@ -699,10 +725,51 @@ class instance_trial_of_the_crusader : public InstanceMapScript return TrialCounter == 50 && TributeToImmortalityElegible; case A_TRIBUTE_TO_DEDICATED_INSANITY: return false/*uiGrandCrusaderAttemptsLeft == 50 && !bHasAtAnyStagePlayerEquippedTooGoodItem*/; + default: + break; } return false; } + + protected: + uint32 TrialCounter; + uint32 EventStage; + uint32 EventTimer; + uint32 NorthrendBeasts; + bool NeedSave; + std::string SaveDataBuffer; + + uint64 BarrentGUID; + uint64 TirionGUID; + uint64 TirionFordringGUID; + uint64 FizzlebangGUID; + uint64 GarroshGUID; + uint64 VarianGUID; + + uint64 GormokGUID; + uint64 AcidmawGUID; + uint64 DreadscaleGUID; + uint64 IcehowlGUID; + uint64 JaraxxusGUID; + uint64 ChampionsControllerGUID; + uint64 DarkbaneGUID; + uint64 LightbaneGUID; + uint64 AnubarakGUID; + + uint64 CrusadersCacheGUID; + uint64 FloorGUID; + uint64 TributeChestGUID; + uint64 MainGateDoorGUID; + uint64 EastPortcullisGUID; + uint64 WebDoorGUID; + + // Achievement stuff + uint32 NotOneButTwoJormungarsTimer; + uint32 ResilienceWillFixItTimer; + uint8 SnoboldCount; + uint8 MistressOfPainCount; + bool TributeToImmortalityElegible; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 0476b2cbacb..b4d35afa8fb 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -16,13 +16,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Trial Of the crusader -SD%Complete: ??% -SDComment: event script based on /dev/rsa -SDCategory: trial_of_the_crusader -EndScriptData */ - //Known Bugs: // - Need better implementation of Gossip and correct gossip text and option @@ -30,6 +23,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "trial_of_the_crusader.h" +#include "Player.h" enum eYells { @@ -84,7 +78,7 @@ enum eYells // Highlord Tirion Fordring - 36095 SAY_STAGE_4_06 = 0, - SAY_STAGE_4_07 = 1, + SAY_STAGE_4_07 = 1 }; struct _Messages @@ -97,23 +91,22 @@ struct _Messages static _Messages _GossipMessage[]= { - {MSG_BEASTS, GOSSIP_ACTION_INFO_DEF+1, false, TYPE_BEASTS}, - {MSG_JARAXXUS, GOSSIP_ACTION_INFO_DEF+2, false, TYPE_JARAXXUS}, - {MSG_CRUSADERS, GOSSIP_ACTION_INFO_DEF+3, false, TYPE_CRUSADERS}, - {MSG_VALKIRIES, GOSSIP_ACTION_INFO_DEF+4, false, TYPE_VALKIRIES}, - {MSG_LICH_KING, GOSSIP_ACTION_INFO_DEF+5, false, TYPE_ANUBARAK}, - {MSG_ANUBARAK, GOSSIP_ACTION_INFO_DEF+6, true, TYPE_ANUBARAK} + {MSG_BEASTS, GOSSIP_ACTION_INFO_DEF + 1, false, BOSS_BEASTS}, + {MSG_JARAXXUS, GOSSIP_ACTION_INFO_DEF + 2, false, BOSS_JARAXXUS}, + {MSG_CRUSADERS, GOSSIP_ACTION_INFO_DEF + 3, false, BOSS_CRUSADERS}, + {MSG_VALKIRIES, GOSSIP_ACTION_INFO_DEF + 4, false, BOSS_VALKIRIES}, + {MSG_LICH_KING, GOSSIP_ACTION_INFO_DEF + 5, false, BOSS_ANUBARAK}, + {MSG_ANUBARAK, GOSSIP_ACTION_INFO_DEF + 6, true, BOSS_ANUBARAK} }; enum { - NUM_MESSAGES = 6, + NUM_MESSAGES = 6 }; class npc_announcer_toc10 : public CreatureScript { public: - npc_announcer_toc10() : CreatureScript("npc_announcer_toc10") { } struct npc_announcer_toc10AI : public ScriptedAI @@ -136,20 +129,20 @@ class npc_announcer_toc10 : public CreatureScript bool OnGossipHello(Player* player, Creature* creature) { - InstanceScript* instanceScript = creature->GetInstanceScript(); - if (!instanceScript) + InstanceScript* instance = creature->GetInstanceScript(); + if (!instance) return true; char const* _message = "We are ready!"; - if (player->isInCombat() || instanceScript->IsEncounterInProgress() || instanceScript->GetData(TYPE_EVENT)) + if (player->isInCombat() || instance->IsEncounterInProgress() || instance->GetData(TYPE_EVENT)) return true; uint8 i = 0; for (; i < NUM_MESSAGES; ++i) { - if ((!_GossipMessage[i].state && instanceScript->GetData(_GossipMessage[i].encounter) != DONE) - || (_GossipMessage[i].state && instanceScript->GetData(_GossipMessage[i].encounter) == DONE)) + if ((!_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) != DONE) + || (_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) == DONE)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, _message, GOSSIP_SENDER_MAIN, _GossipMessage[i].id); break; @@ -160,75 +153,65 @@ class npc_announcer_toc10 : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) { player->PlayerTalkClass->ClearMenus(); player->CLOSE_GOSSIP_MENU(); - InstanceScript* instanceScript = creature->GetInstanceScript(); - if (!instanceScript) + InstanceScript* instance = creature->GetInstanceScript(); + if (!instance) return true; - switch (action) + if (instance->GetBossState(BOSS_BEASTS) != DONE) { - case GOSSIP_ACTION_INFO_DEF+1: - if (instanceScript->GetData(TYPE_BEASTS) != DONE) - { - instanceScript->SetData(TYPE_EVENT, 110); - instanceScript->SetData(TYPE_NORTHREND_BEASTS, NOT_STARTED); - instanceScript->SetData(TYPE_BEASTS, NOT_STARTED); - } - break; - case GOSSIP_ACTION_INFO_DEF+2: - if (Creature* jaraxxus = Unit::GetCreature(*player, instanceScript->GetData64(NPC_JARAXXUS))) - { - jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS); - jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - jaraxxus->SetReactState(REACT_AGGRESSIVE); - jaraxxus->SetInCombatWithZone(); - } - else if (instanceScript->GetData(TYPE_JARAXXUS) != DONE) - { - instanceScript->SetData(TYPE_EVENT, 1010); - instanceScript->SetData(TYPE_JARAXXUS, NOT_STARTED); - } - break; - case GOSSIP_ACTION_INFO_DEF+3: - if (instanceScript->GetData(TYPE_CRUSADERS) != DONE) - { - if (player->GetTeam() == ALLIANCE) - instanceScript->SetData(TYPE_EVENT, 3000); - else - instanceScript->SetData(TYPE_EVENT, 3001); - instanceScript->SetData(TYPE_CRUSADERS, NOT_STARTED); - } - break; - case GOSSIP_ACTION_INFO_DEF+4: - if (instanceScript->GetData(TYPE_VALKIRIES) != DONE) - { - instanceScript->SetData(TYPE_EVENT, 4000); - instanceScript->SetData(TYPE_VALKIRIES, NOT_STARTED); - } - break; - case GOSSIP_ACTION_INFO_DEF+5: + instance->SetData(TYPE_EVENT, 110); + instance->SetData(TYPE_NORTHREND_BEASTS, NOT_STARTED); + instance->SetBossState(BOSS_BEASTS, NOT_STARTED); + } + else if (instance->GetBossState(BOSS_JARAXXUS) != DONE) + { + // if Jaraxxus is spawned, but the raid wiped + if (Creature* jaraxxus = Unit::GetCreature(*player, instance->GetData64(NPC_JARAXXUS))) { - if (instanceScript->GetData(TYPE_LICH_KING) != DONE && !player->isGameMaster()) - return true; - - if (GameObject* floor = GameObject::GetGameObject(*player, instanceScript->GetData64(GO_ARGENT_COLISEUM_FLOOR))) - floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); + jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS); + jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + jaraxxus->SetReactState(REACT_DEFENSIVE); + jaraxxus->SetInCombatWithZone(); + } + else + { + instance->SetData(TYPE_EVENT, 1010); + instance->SetBossState(BOSS_JARAXXUS, NOT_STARTED); + } + } + else if (instance->GetBossState(BOSS_CRUSADERS) != DONE) + { + if (player->GetTeam() == ALLIANCE) + instance->SetData(TYPE_EVENT, 3000); + else + instance->SetData(TYPE_EVENT, 3001); + instance->SetBossState(BOSS_CRUSADERS, NOT_STARTED); + } + else if (instance->GetBossState(BOSS_VALKIRIES) != DONE) + { + instance->SetData(TYPE_EVENT, 4000); + instance->SetBossState(BOSS_VALKIRIES, NOT_STARTED); + } + else if (instance->GetBossState(BOSS_LICH_KING) != DONE) + { + if (GameObject* floor = GameObject::GetGameObject(*player, instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) + floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); - creature->CastSpell(creature, 69016, false); + creature->CastSpell(creature, SPELL_CORPSE_TELEPORT, false); + creature->CastSpell(creature, SPELL_DESTROY_FLOOR_KNOCKUP, false); - Creature* anubArak = Unit::GetCreature(*creature, instanceScript->GetData64(NPC_ANUBARAK)); - if (!anubArak || !anubArak->isAlive()) - anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); + Creature* anubArak = Unit::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK)); + if (!anubArak || !anubArak->isAlive()) + anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); - instanceScript->SetData(TYPE_ANUBARAK, NOT_STARTED); + instance->SetBossState(BOSS_ANUBARAK, NOT_STARTED); - if (creature->IsVisible()) - creature->SetVisible(false); - break; - } + if (creature->IsVisible()) + creature->SetVisible(false); } creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); return true; @@ -243,112 +226,130 @@ class npc_announcer_toc10 : public CreatureScript class boss_lich_king_toc : public CreatureScript { public: - boss_lich_king_toc() : CreatureScript("boss_lich_king_toc") { } struct boss_lich_king_tocAI : public ScriptedAI { boss_lich_king_tocAI(Creature* creature) : ScriptedAI(creature) { - instance = creature->GetInstanceScript(); + _instance = creature->GetInstanceScript(); } - InstanceScript* instance; - uint32 m_uiUpdateTimer; - void Reset() { - m_uiUpdateTimer = 0; + _updateTimer = 0; me->SetReactState(REACT_PASSIVE); - if (Creature* summoned = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5, TEMPSUMMON_TIMED_DESPAWN, 60000)) + if (Creature* summoned = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5, TEMPSUMMON_TIMED_DESPAWN, 1*MINUTE*IN_MILLISECONDS)) { summoned->CastSpell(summoned, 51807, false); - summoned->SetDisplayId(11686); + summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid2); } - if (instance) instance->SetData(TYPE_LICH_KING, IN_PROGRESS); + if (_instance) + _instance->SetBossState(BOSS_LICH_KING, IN_PROGRESS); me->SetWalk(true); } void MovementInform(uint32 uiType, uint32 uiId) { - if (uiType != POINT_MOTION_TYPE || !instance) + if (uiType != POINT_MOTION_TYPE || !_instance) return; + switch (uiId) { case 0: - instance->SetData(TYPE_EVENT, 5030); + _instance->SetData(TYPE_EVENT, 5030); break; case 1: - instance->SetData(TYPE_EVENT, 5050); + _instance->SetData(TYPE_EVENT, 5050); + break; + default: break; } } void UpdateAI(const uint32 uiDiff) { - if (!instance) + if (!_instance) return; - if (instance->GetData(TYPE_EVENT_NPC) != NPC_LICH_KING_1) + if (_instance->GetData(TYPE_EVENT_NPC) != NPC_LICH_KING_1) return; - m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); - if (m_uiUpdateTimer <= uiDiff) + _updateTimer = _instance->GetData(TYPE_EVENT_TIMER); + if (_updateTimer <= uiDiff) { - switch (instance->GetData(TYPE_EVENT)) + switch (_instance->GetData(TYPE_EVENT)) { case 5010: Talk(SAY_STAGE_4_02); - m_uiUpdateTimer = 3000; + _updateTimer = 3*IN_MILLISECONDS; me->GetMotionMaster()->MovePoint(0, LichKingLoc[0]); - instance->SetData(TYPE_EVENT, 5020); + _instance->SetData(TYPE_EVENT, 5020); break; case 5030: Talk(SAY_STAGE_4_04); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); - m_uiUpdateTimer = 10000; - instance->SetData(TYPE_EVENT, 5040); + _updateTimer = 10*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 5040); break; case 5040: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); me->GetMotionMaster()->MovePoint(1, LichKingLoc[1]); - m_uiUpdateTimer = 1000; - instance->SetData(TYPE_EVENT, 0); + _updateTimer = 1*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 0); break; case 5050: me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 5060); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 5060); break; case 5060: Talk(SAY_STAGE_4_05); me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); - m_uiUpdateTimer = 2500; - instance->SetData(TYPE_EVENT, 5070); + _updateTimer = 2.5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 5070); break; case 5070: me->CastSpell(me, 68198, false); - m_uiUpdateTimer = 1500; - instance->SetData(TYPE_EVENT, 5080); + _updateTimer = 1.5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 5080); break; case 5080: - if (GameObject* go = instance->instance->GetGameObject(instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) - go->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); - me->CastSpell(me, 69016, false); - instance->SetData(TYPE_LICH_KING, DONE); - Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_ANUBARAK)); - if (!temp || !temp->isAlive()) - temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); - - instance->SetData(TYPE_EVENT, 0); + if (GameObject* go = _instance->instance->GetGameObject(_instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) + { + go->SetDisplayId(DISPLAYID_DESTROYED_FLOOR); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN); + go->SetGoState(GO_STATE_ACTIVE); + } + + me->CastSpell(me, SPELL_CORPSE_TELEPORT, false); + me->CastSpell(me, SPELL_DESTROY_FLOOR_KNOCKUP, false); + + if (_instance) + { + _instance->SetBossState(BOSS_LICH_KING, DONE); + Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK)); + if (!temp || !temp->isAlive()) + temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); + + _instance->SetData(TYPE_EVENT, 0); + } me->DespawnOrUnsummon(); - m_uiUpdateTimer = 20000; + _updateTimer = 20*IN_MILLISECONDS; + break; + default: break; } - } else m_uiUpdateTimer -= uiDiff; + } + else + _updateTimer -= uiDiff; - instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + _instance->SetData(TYPE_EVENT_TIMER, _updateTimer); } + + private: + InstanceScript* _instance; + uint32 _updateTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -360,27 +361,20 @@ class boss_lich_king_toc : public CreatureScript class npc_fizzlebang_toc : public CreatureScript { public: - npc_fizzlebang_toc() : CreatureScript("npc_fizzlebang_toc") { } struct npc_fizzlebang_tocAI : public ScriptedAI { - npc_fizzlebang_tocAI(Creature* creature) : ScriptedAI(creature), Summons(me) + npc_fizzlebang_tocAI(Creature* creature) : ScriptedAI(creature), _summons(me) { - instance = me->GetInstanceScript(); + _instance = me->GetInstanceScript(); } - InstanceScript* instance; - SummonList Summons; - uint32 m_uiUpdateTimer; - uint64 m_uiPortalGUID; - uint64 m_uiTriggerGUID; - void JustDied(Unit* killer) { Talk(SAY_STAGE_1_06, killer->GetGUID()); - instance->SetData(TYPE_EVENT, 1180); - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) + _instance->SetData(TYPE_EVENT, 1180); + if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) { temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); temp->SetReactState(REACT_AGGRESSIVE); @@ -391,7 +385,7 @@ class npc_fizzlebang_toc : public CreatureScript void Reset() { me->SetWalk(true); - m_uiPortalGUID = 0; + _portalGUID = 0; me->GetMotionMaster()->MovePoint(1, ToCCommonLoc[10].GetPositionX(), ToCCommonLoc[10].GetPositionY()-60, ToCCommonLoc[10].GetPositionZ()); } @@ -404,42 +398,44 @@ class npc_fizzlebang_toc : public CreatureScript { case 1: me->SetWalk(false); - if (instance) + if (_instance) { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - instance->SetData(TYPE_EVENT, 1120); - instance->SetData(TYPE_EVENT_TIMER, 1000); + _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->SetData(TYPE_EVENT, 1120); + _instance->SetData(TYPE_EVENT_TIMER, 1*IN_MILLISECONDS); } break; + default: + break; } } void JustSummoned(Creature* summoned) { - Summons.Summon(summoned); + _summons.Summon(summoned); } void UpdateAI(const uint32 uiDiff) { - if (!instance) + if (!_instance) return; - if (instance->GetData(TYPE_EVENT_NPC) != NPC_FIZZLEBANG) + if (_instance->GetData(TYPE_EVENT_NPC) != NPC_FIZZLEBANG) return; - m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); - if (m_uiUpdateTimer <= uiDiff) + _updateTimer = _instance->GetData(TYPE_EVENT_TIMER); + if (_updateTimer <= uiDiff) { - switch (instance->GetData(TYPE_EVENT)) + switch (_instance->GetData(TYPE_EVENT)) { case 1110: - instance->SetData(TYPE_EVENT, 1120); - m_uiUpdateTimer = 4000; + _instance->SetData(TYPE_EVENT, 1120); + _updateTimer = 4*IN_MILLISECONDS; break; case 1120: Talk(SAY_STAGE_1_02); - instance->SetData(TYPE_EVENT, 1130); - m_uiUpdateTimer = 12000; + _instance->SetData(TYPE_EVENT, 1130); + _updateTimer = 12*IN_MILLISECONDS; break; case 1130: me->GetMotionMaster()->MovementExpired(); @@ -447,18 +443,18 @@ class npc_fizzlebang_toc : public CreatureScript me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI); if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN)) { - m_uiTriggerGUID = pTrigger->GetGUID(); + _triggerGUID = pTrigger->GetGUID(); pTrigger->SetObjectScale(2.0f); - pTrigger->SetDisplayId(22862); + pTrigger->SetDisplayId(pTrigger->ToCreature()->GetCreatureTemplate()->Modelid1); pTrigger->CastSpell(pTrigger, SPELL_WILFRED_PORTAL, false); } - instance->SetData(TYPE_EVENT, 1132); - m_uiUpdateTimer = 4000; + _instance->SetData(TYPE_EVENT, 1132); + _updateTimer = 4*IN_MILLISECONDS; break; case 1132: me->GetMotionMaster()->MovementExpired(); - instance->SetData(TYPE_EVENT, 1134); - m_uiUpdateTimer = 4000; + _instance->SetData(TYPE_EVENT, 1134); + _updateTimer = 4*IN_MILLISECONDS; break; case 1134: me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI); @@ -467,14 +463,14 @@ class npc_fizzlebang_toc : public CreatureScript pPortal->SetReactState(REACT_PASSIVE); pPortal->SetObjectScale(2.0f); pPortal->CastSpell(pPortal, SPELL_WILFRED_PORTAL, false); - m_uiPortalGUID = pPortal->GetGUID(); + _portalGUID = pPortal->GetGUID(); } - m_uiUpdateTimer = 4000; - instance->SetData(TYPE_EVENT, 1135); + _updateTimer = 4*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 1135); break; case 1135: - instance->SetData(TYPE_EVENT, 1140); - m_uiUpdateTimer = 3000; + _instance->SetData(TYPE_EVENT, 1140); + _updateTimer = 3*IN_MILLISECONDS; break; case 1140: Talk(SAY_STAGE_1_04); @@ -484,27 +480,27 @@ class npc_fizzlebang_toc : public CreatureScript temp->SetReactState(REACT_PASSIVE); temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()-10, ToCCommonLoc[1].GetPositionZ()); } - instance->SetData(TYPE_EVENT, 1142); - m_uiUpdateTimer = 5000; + _instance->SetData(TYPE_EVENT, 1142); + _updateTimer = 5*IN_MILLISECONDS; break; case 1142: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) temp->SetTarget(me->GetGUID()); - if (Creature* pTrigger = Unit::GetCreature(*me, m_uiTriggerGUID)) + if (Creature* pTrigger = Unit::GetCreature(*me, _triggerGUID)) pTrigger->DespawnOrUnsummon(); - if (Creature* pPortal = Unit::GetCreature(*me, m_uiPortalGUID)) + if (Creature* pPortal = Unit::GetCreature(*me, _portalGUID)) pPortal->DespawnOrUnsummon(); - instance->SetData(TYPE_EVENT, 1144); - m_uiUpdateTimer = 10000; + _instance->SetData(TYPE_EVENT, 1144); + _updateTimer = 10*IN_MILLISECONDS; break; case 1144: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) temp->AI()->Talk(SAY_STAGE_1_05); - instance->SetData(TYPE_EVENT, 1150); - m_uiUpdateTimer = 5000; + _instance->SetData(TYPE_EVENT, 1150); + _updateTimer = 5*IN_MILLISECONDS; break; case 1150: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) { //1-shot Fizzlebang temp->CastSpell(me, 67888, false); @@ -512,13 +508,22 @@ class npc_fizzlebang_toc : public CreatureScript temp->AddThreat(me, 1000.0f); temp->AI()->AttackStart(me); } - instance->SetData(TYPE_EVENT, 1160); - m_uiUpdateTimer = 3000; + _instance->SetData(TYPE_EVENT, 1160); + _updateTimer = 3*IN_MILLISECONDS; break; } - } else m_uiUpdateTimer -= uiDiff; - instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + } + else + _updateTimer -= uiDiff; + _instance->SetData(TYPE_EVENT_TIMER, _updateTimer); } + + private: + InstanceScript* _instance; + SummonList _summons; + uint32 _updateTimer; + uint64 _portalGUID; + uint64 _triggerGUID; }; CreatureAI* GetAI(Creature* creature) const @@ -530,53 +535,49 @@ class npc_fizzlebang_toc : public CreatureScript class npc_tirion_toc : public CreatureScript { public: - npc_tirion_toc() : CreatureScript("npc_tirion_toc") { } struct npc_tirion_tocAI : public ScriptedAI { npc_tirion_tocAI(Creature* creature) : ScriptedAI(creature) { - instance = me->GetInstanceScript(); + _instance = me->GetInstanceScript(); } - InstanceScript* instance; - uint32 m_uiUpdateTimer; - void Reset() {} void AttackStart(Unit* /*who*/) {} void UpdateAI(const uint32 uiDiff) { - if (!instance) + if (!_instance) return; - if (instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION) + if (_instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION) return; - m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); - if (m_uiUpdateTimer <= uiDiff) + _updateTimer = _instance->GetData(TYPE_EVENT_TIMER); + if (_updateTimer <= uiDiff) { - switch (instance->GetData(TYPE_EVENT)) + switch (_instance->GetData(TYPE_EVENT)) { case 110: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); Talk(SAY_STAGE_0_01); - m_uiUpdateTimer = 22000; - instance->SetData(TYPE_EVENT, 120); + _updateTimer = 22*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 120); break; case 140: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); Talk(SAY_STAGE_0_02); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 150); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 150); break; case 150: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - if (instance->GetData(TYPE_BEASTS) != DONE) + if (_instance->GetBossState(BOSS_BEASTS) != DONE) { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_GORMOK, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS)) { @@ -585,154 +586,133 @@ class npc_tirion_toc : public CreatureScript temp->SetReactState(REACT_PASSIVE); } } - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 155); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 155); break; case 155: - instance->SetData(TYPE_BEASTS, IN_PROGRESS); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 160); + // keep the raid in combat for the whole encounter, pauses included + me->SetInCombatWithZone(); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 160); break; case 200: Talk(SAY_STAGE_0_04); - m_uiUpdateTimer = 8000; - instance->SetData(TYPE_EVENT, 205); - break; - case 205: - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 210); - break; - case 210: - if (instance->GetData(TYPE_BEASTS) != DONE) + if (_instance->GetBossState(BOSS_BEASTS) != DONE) { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_DREADSCALE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { - temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - temp->SetReactState(REACT_PASSIVE); - } - if (Creature* temp = me->SummonCreature(NPC_ACIDMAW, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) - { - temp->SetVisible(true); + temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); temp->SetReactState(REACT_PASSIVE); } } - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 220); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 220); break; case 220: - instance->SetData(TYPE_EVENT, 230); + _instance->SetData(TYPE_EVENT, 230); break; case 300: Talk(SAY_STAGE_0_05); - m_uiUpdateTimer = 8000; - instance->SetData(TYPE_EVENT, 305); - break; - case 305: - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 310); - break; - case 310: - if (instance->GetData(TYPE_BEASTS) != DONE) + if (_instance->GetBossState(BOSS_BEASTS) != DONE) { - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_ICEHOWL, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN)) { temp->GetMotionMaster()->MovePoint(2, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); - } } - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 315); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 315); break; case 315: - instance->SetData(TYPE_EVENT, 320); + _instance->SetData(TYPE_EVENT, 320); break; case 400: Talk(SAY_STAGE_0_06); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 0); + me->getThreatManager().clearReferences(); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 0); break; case 666: Talk(SAY_STAGE_0_WIPE); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 0); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 0); break; case 1010: Talk(SAY_STAGE_1_01); - m_uiUpdateTimer = 7000; - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); + _updateTimer = 7*IN_MILLISECONDS; + _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); - instance->SetData(TYPE_EVENT, 0); + _instance->SetData(TYPE_EVENT, 0); break; case 1180: Talk(SAY_STAGE_1_07); - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 0); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 0); break; case 2000: Talk(SAY_STAGE_1_08); - m_uiUpdateTimer = 18000; - instance->SetData(TYPE_EVENT, 2010); + _updateTimer = 18*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 2010); break; case 2030: Talk(SAY_STAGE_1_11); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 0); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 0); break; case 3000: Talk(SAY_STAGE_2_01); - m_uiUpdateTimer = 12000; - instance->SetData(TYPE_EVENT, 3050); + _updateTimer = 12*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3050); break; case 3001: Talk(SAY_STAGE_2_01); - m_uiUpdateTimer = 12000; - instance->SetData(TYPE_EVENT, 3051); + _updateTimer = 10*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3051); break; case 3060: Talk(SAY_STAGE_2_03); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 3070); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3070); break; case 3061: Talk(SAY_STAGE_2_03); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 3071); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3071); break; //Summoning crusaders case 3091: if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1])) pChampionController->AI()->SetData(0, HORDE); - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 3092); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3092); break; //Summoning crusaders case 3090: if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1])) pChampionController->AI()->SetData(0, ALLIANCE); - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 3092); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3092); break; case 3092: - if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = Unit::GetCreature((*me), _instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(1, NOT_STARTED); - instance->SetData(TYPE_EVENT, 3095); + _instance->SetData(TYPE_EVENT, 3095); break; //Crusaders battle end case 3100: Talk(SAY_STAGE_2_06); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 0); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 0); break; case 4000: Talk(SAY_STAGE_3_01); - m_uiUpdateTimer = 13000; - instance->SetData(TYPE_EVENT, 4010); + _updateTimer = 13*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 4010); break; case 4010: Talk(SAY_STAGE_3_02); @@ -750,78 +730,88 @@ class npc_tirion_toc : public CreatureScript temp->SummonCreature(NPC_DARK_ESSENCE, TwinValkyrsLoc[2].GetPositionX(), TwinValkyrsLoc[2].GetPositionY(), TwinValkyrsLoc[2].GetPositionZ()); temp->SummonCreature(NPC_DARK_ESSENCE, TwinValkyrsLoc[3].GetPositionX(), TwinValkyrsLoc[3].GetPositionY(), TwinValkyrsLoc[3].GetPositionZ()); } - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 4015); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 4015); break; case 4015: - instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR)); - if (Creature* temp = Unit::GetCreature((*me), instance->GetData64(NPC_LIGHTBANE))) + _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + if (Creature* temp = Unit::GetCreature((*me), _instance->GetData64(NPC_LIGHTBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); temp->SetVisible(true); } - if (Creature* temp = Unit::GetCreature((*me), instance->GetData64(NPC_DARKBANE))) + if (Creature* temp = Unit::GetCreature((*me), _instance->GetData64(NPC_DARKBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ()); temp->SetVisible(true); } - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 4016); + _updateTimer = 10*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 4016); break; case 4016: - instance->SetData(TYPE_EVENT, 4017); + _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); + _instance->SetData(TYPE_EVENT, 4017); break; case 4040: - m_uiUpdateTimer = 60000; - instance->SetData(TYPE_EVENT, 5000); + _updateTimer = 1*MINUTE*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 5000); break; case 5000: Talk(SAY_STAGE_4_01); - m_uiUpdateTimer = 10000; - instance->SetData(TYPE_EVENT, 5005); + _updateTimer = 10*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 5005); break; case 5005: - m_uiUpdateTimer = 8000; - instance->SetData(TYPE_EVENT, 5010); + _updateTimer = 8*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 5010); me->SummonCreature(NPC_LICH_KING_1, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5); break; case 5020: Talk(SAY_STAGE_4_03); - m_uiUpdateTimer = 1000; - instance->SetData(TYPE_EVENT, 0); + _updateTimer = 1*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 0); break; case 6000: me->SummonCreature(NPC_TIRION_FORDRING, EndSpawnLoc[0].GetPositionX(), EndSpawnLoc[0].GetPositionY(), EndSpawnLoc[0].GetPositionZ()); me->SummonCreature(NPC_ARGENT_MAGE, EndSpawnLoc[1].GetPositionX(), EndSpawnLoc[1].GetPositionY(), EndSpawnLoc[1].GetPositionZ()); me->SummonGameObject(GO_PORTAL_TO_DALARAN, EndSpawnLoc[2].GetPositionX(), EndSpawnLoc[2].GetPositionY(), EndSpawnLoc[2].GetPositionZ(), 5, 0, 0, 0, 0, 0); - m_uiUpdateTimer = 20000; - instance->SetData(TYPE_EVENT, 6005); + _updateTimer = 20*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 6005); break; case 6005: - if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING))) + if (Creature* tirionFordring = Unit::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING))) tirionFordring->AI()->Talk(SAY_STAGE_4_06); - m_uiUpdateTimer = 20000; - instance->SetData(TYPE_EVENT, 6010); + _updateTimer = 20*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 6010); break; case 6010: if (IsHeroic()) { - if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING))) + if (Creature* tirionFordring = Unit::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING))) tirionFordring->AI()->Talk(SAY_STAGE_4_07); - m_uiUpdateTimer = 60000; - instance->SetData(TYPE_ANUBARAK, SPECIAL); - instance->SetData(TYPE_EVENT, 6020); - } else instance->SetData(TYPE_EVENT, 6030); + _updateTimer = 1*MINUTE*IN_MILLISECONDS; + _instance->SetBossState(BOSS_ANUBARAK, SPECIAL); + _instance->SetData(TYPE_EVENT, 6020); + } + else + _instance->SetData(TYPE_EVENT, 6030); break; case 6020: me->DespawnOrUnsummon(); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 6030); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 6030); + break; + default: break; } - } else m_uiUpdateTimer -= uiDiff; - instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + } + else + _updateTimer -= uiDiff; + _instance->SetData(TYPE_EVENT_TIMER, _updateTimer); } + private: + InstanceScript* _instance; + uint32 _updateTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -833,76 +823,79 @@ class npc_tirion_toc : public CreatureScript class npc_garrosh_toc : public CreatureScript { public: - npc_garrosh_toc() : CreatureScript("npc_garrosh_toc") { } struct npc_garrosh_tocAI : public ScriptedAI { npc_garrosh_tocAI(Creature* creature) : ScriptedAI(creature) { - instance = me->GetInstanceScript(); + _instance = me->GetInstanceScript(); } - InstanceScript* instance; - uint32 m_uiUpdateTimer; - void Reset() {} void AttackStart(Unit* /*who*/) {} void UpdateAI(const uint32 uiDiff) { - if (!instance) + if (!_instance) return; - if (instance->GetData(TYPE_EVENT_NPC) != NPC_GARROSH) + if (_instance->GetData(TYPE_EVENT_NPC) != NPC_GARROSH) return; - m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); - if (m_uiUpdateTimer <= uiDiff) + _updateTimer = _instance->GetData(TYPE_EVENT_TIMER); + if (_updateTimer <= uiDiff) { - switch (instance->GetData(TYPE_EVENT)) + switch (_instance->GetData(TYPE_EVENT)) { case 130: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); Talk(SAY_STAGE_0_03h); - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 132); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 132); break; case 132: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 140); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 140); break; case 2010: Talk(SAY_STAGE_1_09); - m_uiUpdateTimer = 9000; - instance->SetData(TYPE_EVENT, 2020); + _updateTimer = 9*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 2020); break; case 3050: Talk(SAY_STAGE_2_02h); - m_uiUpdateTimer = 15000; - instance->SetData(TYPE_EVENT, 3060); + _updateTimer = 15*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3060); break; case 3070: Talk(SAY_STAGE_2_04h); - m_uiUpdateTimer = 6000; - instance->SetData(TYPE_EVENT, 3080); + _updateTimer = 6*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3080); break; case 3081: Talk(SAY_STAGE_2_05h); - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 3091); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3091); break; case 4030: Talk(SAY_STAGE_3_03h); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 4040); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 4040); + break; + default: break; } - } else m_uiUpdateTimer -= uiDiff; - instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + } + else + _updateTimer -= uiDiff; + _instance->SetData(TYPE_EVENT_TIMER, _updateTimer); } + private: + InstanceScript* _instance; + uint32 _updateTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -914,76 +907,79 @@ class npc_garrosh_toc : public CreatureScript class npc_varian_toc : public CreatureScript { public: - npc_varian_toc() : CreatureScript("npc_varian_toc") { } struct npc_varian_tocAI : public ScriptedAI { npc_varian_tocAI(Creature* creature) : ScriptedAI(creature) { - instance = me->GetInstanceScript(); + _instance = me->GetInstanceScript(); } - InstanceScript* instance; - uint32 m_uiUpdateTimer; - void Reset() {} void AttackStart(Unit* /*who*/) {} void UpdateAI(const uint32 uiDiff) { - if (!instance) + if (!_instance) return; - if (instance->GetData(TYPE_EVENT_NPC) != NPC_VARIAN) + if (_instance->GetData(TYPE_EVENT_NPC) != NPC_VARIAN) return; - m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); - if (m_uiUpdateTimer <= uiDiff) + _updateTimer = _instance->GetData(TYPE_EVENT_TIMER); + if (_updateTimer <= uiDiff) { - switch (instance->GetData(TYPE_EVENT)) + switch (_instance->GetData(TYPE_EVENT)) { case 120: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); Talk(SAY_STAGE_0_03a); - m_uiUpdateTimer = 2000; - instance->SetData(TYPE_EVENT, 122); + _updateTimer = 2*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 122); break; case 122: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 130); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 130); break; case 2020: Talk(SAY_STAGE_1_10); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 2030); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 2030); break; case 3051: Talk(SAY_STAGE_2_02a); - m_uiUpdateTimer = 10000; - instance->SetData(TYPE_EVENT, 3061); + _updateTimer = 17*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3061); break; case 3071: Talk(SAY_STAGE_2_04a); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 3081); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3081); break; case 3080: Talk(SAY_STAGE_2_05a); - m_uiUpdateTimer = 3000; - instance->SetData(TYPE_EVENT, 3090); + _updateTimer = 3*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 3090); break; case 4020: Talk(SAY_STAGE_3_03a); - m_uiUpdateTimer = 5000; - instance->SetData(TYPE_EVENT, 4040); + _updateTimer = 5*IN_MILLISECONDS; + _instance->SetData(TYPE_EVENT, 4040); + break; + default: break; } - } else m_uiUpdateTimer -= uiDiff; - instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); + } + else + _updateTimer -= uiDiff; + _instance->SetData(TYPE_EVENT_TIMER, _updateTimer); } + private: + InstanceScript* _instance; + uint32 _updateTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -994,8 +990,8 @@ class npc_varian_toc : public CreatureScript void AddSC_trial_of_the_crusader() { - new npc_announcer_toc10(); new boss_lich_king_toc(); + new npc_announcer_toc10(); new npc_fizzlebang_toc(); new npc_tirion_toc(); new npc_garrosh_toc(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index 58cbd727963..fa38b6b46c1 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -7,12 +7,12 @@ enum { - TYPE_BEASTS = 0, - TYPE_JARAXXUS = 1, - TYPE_CRUSADERS = 2, - TYPE_VALKIRIES = 3, - TYPE_LICH_KING = 4, - TYPE_ANUBARAK = 5, + BOSS_BEASTS = 0, + BOSS_JARAXXUS = 1, + BOSS_CRUSADERS = 2, + BOSS_VALKIRIES = 3, + BOSS_LICH_KING = 4, // not really a boss but oh well + BOSS_ANUBARAK = 5, MAX_ENCOUNTERS = 6, TYPE_COUNTER = 8, @@ -31,15 +31,19 @@ enum SPELL_WILFRED_PORTAL = 68424, SPELL_JARAXXUS_CHAINS = 67924, + SPELL_CORPSE_TELEPORT = 69016, + SPELL_DESTROY_FLOOR_KNOCKUP = 68193, DESPAWN_TIME = 300000, + + DISPLAYID_DESTROYED_FLOOR = 9060 }; const Position ToCSpawnLoc[]= { {563.912f, 261.625f, 394.73f, 4.70437f}, // 0 Center {575.451f, 261.496f, 394.73f, 4.6541f}, // 1 Left - {549.951f, 261.55f, 394.73f, 4.74835f}, // 2 Right + {549.951f, 261.55f, 394.73f, 4.74835f} // 2 Right }; const Position ToCCommonLoc[]= @@ -68,7 +72,7 @@ const Position ToCCommonLoc[]= {558.811610f, 195.985779f, 394.671661f, 0}, // 13 {567.641724f, 195.351501f, 394.659943f, 0}, // 14 {560.633972f, 195.391708f, 395.137543f, 0}, // 15 - {565.816956f, 195.477921f, 395.136810f, 0}, // 16 + {565.816956f, 195.477921f, 395.136810f, 0} // 16 }; const Position JaraxxusLoc[]= @@ -76,7 +80,7 @@ const Position JaraxxusLoc[]= {508.104767f, 138.247345f, 395.128052f, 0}, // 0 - Fizzlebang start location {548.610596f, 139.807800f, 394.321838f, 0}, // 1 - fizzlebang end {581.854187f, 138.0f, 394.319f, 0}, // 2 - Portal Right - {550.558838f, 138.0f, 394.319f, 0}, // 3 - Portal Left + {550.558838f, 138.0f, 394.319f, 0} // 3 - Portal Left }; const Position FactionChampionLoc[]= @@ -102,21 +106,21 @@ const Position FactionChampionLoc[]= {528.958f, 131.47f, 394.73f, 0}, // 16 - Horde Final Pos 6 {526.309f, 116.667f, 394.833f, 0}, // 17 - Horde Final Pos 7 {524.238f, 122.411f, 394.819f, 0}, // 18 - Horde Final Pos 8 - {521.901f, 128.488f, 394.832f, 0}, // 19 - Horde Final Pos 9 + {521.901f, 128.488f, 394.832f, 0} // 19 - Horde Final Pos 9 }; const Position TwinValkyrsLoc[]= { - {586.060242f, 117.514809f, 394.314026f, 0}, // 0 - Dark essence 1 - {541.602112f, 161.879837f, 394.587952f, 0}, // 1 - Dark essence 2 - {541.021118f, 117.262932f, 395.314819f, 0}, // 2 - Light essence 1 - {586.200562f, 162.145523f, 394.626129f, 0}, // 3 - Light essence 2 + {586.060242f, 117.514809f, 394.41f, 0}, // 0 - Dark essence 1 + {541.602112f, 161.879837f, 394.41f, 0}, // 1 - Dark essence 2 + {541.021118f, 117.262932f, 394.41f, 0}, // 2 - Light essence 1 + {586.200562f, 162.145523f, 394.41f, 0} // 3 - Light essence 2 }; const Position LichKingLoc[]= { {563.549f, 152.474f, 394.393f, 0}, // 0 - Lich king start - {563.547f, 141.613f, 393.908f, 0}, // 1 - Lich king end + {563.547f, 141.613f, 393.908f, 0} // 1 - Lich king end }; const Position AnubarakLoc[]= @@ -126,20 +130,20 @@ const Position AnubarakLoc[]= {694.886353f, 102.484665f, 142.119614f, 0}, // 3 - Nerub Spawn {694.500671f, 185.363968f, 142.117905f, 0}, // 5 - Nerub Spawn {731.987244f, 83.3824690f, 142.119614f, 0}, // 2 - Nerub Spawn - {740.184509f, 193.443390f, 142.117584f, 0}, // 4 - Nerub Spawn + {740.184509f, 193.443390f, 142.117584f, 0} // 4 - Nerub Spawn }; const Position EndSpawnLoc[]= { {648.9167f, 131.0208f, 141.6161f, 0}, // 0 - Highlord Tirion Fordring {649.1614f, 142.0399f, 141.3057f ,0}, // 1 - Argent Mage - {644.6250f, 149.2743f, 140.6015f ,0}, // 2 - Portal to Dalaran + {644.6250f, 149.2743f, 140.6015f ,0} // 2 - Portal to Dalaran }; enum euiWorldStates { UPDATE_STATE_UI_SHOW = 4390, - UPDATE_STATE_UI_COUNT = 4389, + UPDATE_STATE_UI_COUNT = 4389 }; enum eNorthrendBeasts @@ -152,7 +156,7 @@ enum eNorthrendBeasts SNAKES_SPECIAL = 2003, SNAKES_DONE = 2004, ICEHOWL_IN_PROGRESS = 3000, - ICEHOWL_DONE = 3001, + ICEHOWL_DONE = 3001 }; enum eAnnouncerMessages @@ -162,7 +166,7 @@ enum eAnnouncerMessages MSG_CRUSADERS = 724003, MSG_VALKIRIES = 724004, MSG_LICH_KING = 724005, - MSG_ANUBARAK = 724006, + MSG_ANUBARAK = 724006 }; enum eCreature @@ -227,7 +231,7 @@ enum eCreature NPC_DARK_ESSENCE = 34567, NPC_LIGHT_ESSENCE = 34568, - NPC_ANUBARAK = 34564, + NPC_ANUBARAK = 34564 }; enum eGameObject @@ -253,7 +257,7 @@ enum eGameObject GO_MAIN_GATE_DOOR = 195647, GO_EAST_PORTCULLIS = 195648, GO_WEB_DOOR = 195485, - GO_PORTAL_TO_DALARAN = 195682, + GO_PORTAL_TO_DALARAN = 195682 }; enum eAchievementData diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp index 8b39fc51766..759f8df7153 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp @@ -154,7 +154,7 @@ class boss_dred : public CreatureScript ++raptorsKilled; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_KING_DRED) return raptorsKilled; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 5d9acf4fca7..6ce56958d60 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -208,7 +208,7 @@ public: ohNovos = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_OH_NOVOS) return ohNovos ? 1 : 0; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index 969ccf4a059..79739280055 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "drak_tharon_keep.h" +#include "Player.h" enum Spells { diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 31b7787623c..d8c720b6f95 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -168,7 +168,7 @@ public: instance->SetData(DATA_TROLLGORE_EVENT, DONE); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_CONSUMPTION_JUNCTION) return consumptionJunction ? 1 : 0; diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 99401c1d944..552798e96eb 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -129,7 +129,7 @@ public: } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -174,7 +174,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index 4fdcf96192b..714e5df6444 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "forge_of_souls.h" +#include "Player.h" +#include "SpellInfo.h" /* * TODO: @@ -245,7 +247,7 @@ class boss_devourer_of_souls : public CreatureScript threeFaced = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_THREE_FACED) return threeFaced; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index c23479eea22..2f89d3bd503 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "forge_of_souls.h" +#include "Player.h" enum Events { diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index 618b2b6a9a6..3afc248ab9d 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "forge_of_souls.h" +#include "Player.h" #define MAX_ENCOUNTER 2 @@ -72,7 +73,7 @@ class instance_forge_of_souls : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -85,7 +86,7 @@ class instance_forge_of_souls : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 26ec9e53213..4f80fd746ee 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "halls_of_reflection.h" +#include "Player.h" enum Yells { diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index e3604890e39..2e0c3364bbd 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "InstanceScript.h" #include "halls_of_reflection.h" +#include "Player.h" #define MAX_ENCOUNTER 3 @@ -244,7 +245,7 @@ public: SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -258,7 +259,7 @@ public: return 0; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index a12bd96f6df..cdc21eb25ec 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -186,7 +186,7 @@ class boss_garfrost : public CreatureScript } } - uint32 GetData(uint32 /*type*/) + uint32 GetData(uint32 /*type*/) const { return _permafrostStack; } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 0d6e779c006..41cfc300958 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -21,6 +21,7 @@ #include "SpellAuraEffects.h" #include "pit_of_saron.h" #include "Vehicle.h" +#include "Player.h" enum Spells { diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index ef4d9182f82..44d9230a8d2 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -21,6 +21,7 @@ #include "SpellAuraEffects.h" #include "pit_of_saron.h" #include "Vehicle.h" +#include "Player.h" enum Yells { diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index a6537c45d6f..df0829b3376 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "pit_of_saron.h" +#include "Player.h" // positions for Martin Victus (37591) and Gorkun Ironskull (37592) Position const SlaveLeaderPos = {689.7158f, -104.8736f, 513.7360f, 0.0f}; @@ -223,7 +224,7 @@ class instance_pit_of_saron : public InstanceMapScript return true; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -236,7 +237,7 @@ class instance_pit_of_saron : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index fd1aba79e83..3724aaf69e2 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -22,6 +22,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "gundrak.h" +#include "SpellInfo.h" enum Spells { @@ -190,7 +191,7 @@ class boss_drakkari_colossus : public CreatureScript } } - uint32 GetData(uint32 data) + uint32 GetData(uint32 data) const { if (data == DATA_COLOSSUS_PHASE) return phase; diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index 0d89c402054..595331d99d7 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -258,7 +258,7 @@ public: impaledList.push_back(guid); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_SHARE_THE_LOVE) return shareTheLove; diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp index c1301dbd2d0..45c55f7ec9b 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp @@ -144,7 +144,7 @@ public: DoMeleeAttackIfReady(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_LESS_RABI) return bPhase ? 0 : 1; diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 251c9ec2b83..f35228d44d9 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "SpellAuras.h" #include "gundrak.h" +#include "Player.h" //Spells enum Spells @@ -324,4 +325,4 @@ void AddSC_boss_slad_ran() new mob_slad_ran_constrictor(); new mob_slad_ran_viper(); new achievement_snakes_whyd_it_have_to_be_snakes(); -}
\ No newline at end of file +} diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index 15315c721d7..b8b9c2e9053 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "gundrak.h" +#include "Player.h" +#include "TemporarySummon.h" #define MAX_ENCOUNTER 5 @@ -317,7 +319,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -338,7 +340,7 @@ public: return 0; } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 1b12f17ce64..f28b94c858e 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -20,6 +20,7 @@ #include "ScriptedCreature.h" #include "SpellAuraEffects.h" #include "icecrown_citadel.h" +#include "Player.h" enum Texts { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 5d3a6814eb2..9ee4bcea4d9 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -21,6 +21,7 @@ #include "ScriptedGossip.h" #include "SpellAuras.h" #include "icecrown_citadel.h" +#include "Player.h" enum ScriptTexts { @@ -496,7 +497,7 @@ class boss_deathbringer_saurfang : public CreatureScript DoMeleeAttackIfReady(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_MADE_A_MESS) if (_fallenChampionCastCount < RAID_MODE<uint32>(3, 5, 3, 5)) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index 58856f9fb44..9c0f2139b1b 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -244,7 +244,7 @@ class boss_festergut : public CreatureScript _maxInoculatedStack = data; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_INOCULATED_STACK) return uint32(_maxInoculatedStack); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index e2f9faf6a97..8e7f891663e 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -22,6 +22,7 @@ #include "Group.h" #include "icecrown_citadel.h" #include "SpellInfo.h" +#include "Player.h" enum ScriptTexts { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 0c5cb0aba52..263d70c6a50 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -21,6 +21,7 @@ #include "SpellAuras.h" #include "MapManager.h" #include "icecrown_citadel.h" +#include "Player.h" enum ScriptTexts { @@ -246,7 +247,7 @@ class boss_lord_marrowgar : public CreatureScript return &_coldflameLastPos; } - uint64 GetGUID(int32 type/* = 0 */) + uint64 GetGUID(int32 type/* = 0 */) const { if (type == DATA_COLDFLAME_GUID) return _coldflameTarget; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 64f49c6e0e7..a950a74e59c 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -536,21 +536,15 @@ class boss_professor_putricide : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { case DATA_EXPERIMENT_STAGE: - { - // ALSO MODIFIES! - uint32 ret = uint32(_experimentState); - _experimentState ^= true; - return ret; - } + return _experimentState; case DATA_PHASE: return _phase; case DATA_ABOMINATION: - summons.RemoveNotExisting(); return uint32(summons.HasEntry(NPC_MUTATED_ABOMINATION_10) || summons.HasEntry(NPC_MUTATED_ABOMINATION_25)); default: break; @@ -1010,7 +1004,11 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader if (GetCaster()->GetTypeId() != TYPEID_UNIT) return; - uint32 stage = GetCaster()->ToCreature()->AI()->GetData(DATA_EXPERIMENT_STAGE); + Creature* creature = GetCaster()->ToCreature(); + + uint32 stage = creature->AI()->GetData(DATA_EXPERIMENT_STAGE); + creature->AI()->SetData(DATA_EXPERIMENT_STAGE, !stage); + Creature* target = NULL; std::list<Creature*> creList; GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index e3c0f2260df..a12a38b2f62 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -290,7 +290,7 @@ class boss_sindragosa : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_MYSTIC_BUFFET_STACK) return _mysticBuffetStack; @@ -978,7 +978,7 @@ class npc_sindragosa_trash : public CreatureScript _isTaunted = data != 0; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_FROSTWYRM_OWNER) return _frostwyrmId; 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 ba1a0614cdf..ec5172aeb83 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -636,7 +636,7 @@ class boss_the_lich_king : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 826c62a4390..cc40a076300 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -460,7 +460,7 @@ class boss_valithria_dreamwalker : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == MISSED_PORTALS) return _missedPortals; @@ -1019,7 +1019,7 @@ class npc_dream_portal : public CreatureScript me->DespawnOrUnsummon(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { return (type == MISSED_PORTALS && _used) ? 0 : 1; } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 31639a698ef..4e117d9f3e3 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -21,6 +21,7 @@ #include "SpellScript.h" #include "Map.h" #include "Creature.h" +#include "SpellMgr.h" #define ICCScriptName "instance_icecrown_citadel" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp index af8aba57a6d..7ff995d4bcf 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp @@ -20,6 +20,7 @@ #include "InstanceScript.h" #include "icecrown_citadel.h" #include "Spell.h" +#include "Player.h" #define GOSSIP_SENDER_ICC_PORT 631 diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 650f426d29c..89d7b0f764d 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -23,6 +23,9 @@ #include "PoolMgr.h" #include "AccountMgr.h" #include "icecrown_citadel.h" +#include "Player.h" +#include "WorldPacket.h" +#include "WorldSession.h" enum EventIds { @@ -589,7 +592,7 @@ class instance_icecrown_citadel : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -614,7 +617,7 @@ class instance_icecrown_citadel : public InstanceMapScript return 0; } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index 636f2318712..a75f87e91af 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "naxxramas.h" +#include "SpellInfo.h" enum Yells { @@ -117,7 +118,7 @@ class boss_faerlina : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_FRENZY_DISPELS) return _frenzyDispels; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index 5a55a4f1c4b..7ed9e950b53 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "naxxramas.h" +#include "SpellInfo.h" #define SPELL_BOMBARD_SLIME 28280 diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index 93eab5df237..e7126ba7e33 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "SpellScript.h" #include "naxxramas.h" +#include "Player.h" #define SAY_AGGRO RAND(-1533109, -1533110, -1533111) #define SAY_SLAY -1533112 @@ -80,7 +81,7 @@ public: safetyDance = data ? true : false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_SAFETY_DANCE) return safetyDance ? 1 : 0; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index c88377da3f3..9167db45d20 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "SpellScript.h" #include "SpellAuraEffects.h" #include "naxxramas.h" +#include "Player.h" enum Yells { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp index 71623cb1959..183d56a48c0 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp @@ -85,7 +85,7 @@ class boss_loatheb : public CreatureScript _sporeLoserData = false; } - uint32 GetData(uint32 id) + uint32 GetData(uint32 id) const { if (id != DATA_ACHIEVEMENT_SPORE_LOSER) return 0; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index a2acf8a64da..5a8f004788d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "naxxramas.h" +#include "Player.h" +#include "SpellInfo.h" #define EMOTE_BREATH -1533082 #define EMOTE_ENRAGE -1533083 diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index e45700ebd72..482f8a1200d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -18,7 +18,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" - +#include "Player.h" #include "naxxramas.h" //Stalagg @@ -215,7 +215,7 @@ public: polaritySwitch = data ? true : false; } - uint32 GetData(uint32 id) + uint32 GetData(uint32 id) const { if (id != DATA_POLARITY_SWITCH) return 0; diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index e806b60c848..b68d8d4a33c 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -316,7 +316,7 @@ public: } } - uint32 GetData(uint32 id) + uint32 GetData(uint32 id) const { switch (id) { @@ -329,7 +329,7 @@ public: return 0; } - uint64 GetData64(uint32 id) + uint64 GetData64(uint32 id) const { switch (id) { diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 28f73ed14b0..5e7104fd83a 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -34,6 +34,7 @@ Script Data End */ #include "PassiveAI.h" #include "eye_of_eternity.h" #include "ScriptedEscortAI.h" +#include "Player.h" enum Achievements { @@ -250,7 +251,7 @@ public: instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } - uint32 GetData(uint32 data) + uint32 GetData(uint32 data) const { if (data == DATA_SUMMON_DEATHS) return _summonDeaths; diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index f6a12eee519..4ca28943be3 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "InstanceScript.h" #include "eye_of_eternity.h" +#include "Player.h" class instance_eye_of_eternity : public InstanceMapScript { @@ -225,7 +226,7 @@ public: } } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp index af0ca6b3a3f..80a5336a30c 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp @@ -110,7 +110,7 @@ class boss_anomalus : public CreatureScript instance->SetData(DATA_ANOMALUS_EVENT, DONE); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_CHAOS_THEORY) return chaosTheory ? 1 : 0; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index 9e6930118f7..bbd86ec6a9f 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -21,6 +21,7 @@ #include "SpellScript.h" #include "SpellAuraEffects.h" #include "nexus.h" +#include "Player.h" enum Spells { diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index 9602d1bc876..317a9845e87 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -155,7 +155,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_SPLIT_PERSONALITY) return splitPersonality; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index eb0b3692f01..11b1bce9ab7 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -19,96 +19,86 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "nexus.h" +#include "SpellScript.h" enum Spells { - SPELL_CRYSTAL_SPIKES = 47958, //Don't work, using walkaround - H_SPELL_CRYSTAL_SPIKES = 57082, //Don't work, using walkaround - SPELL_CRYSTALL_SPIKE_DAMAGE = 47944, - H_SPELL_CRYSTALL_SPIKE_DAMAGE = 57067, - SPELL_CRYSTAL_SPIKE_PREVISUAL = 50442, - MOB_CRYSTAL_SPIKE = 27099, - SPELL_SPELL_REFLECTION = 47981, - SPELL_TRAMPLE = 48016, - H_SPELL_TRAMPLE = 57066, - SPELL_FRENZY = 48017, - SPELL_SUMMON_CRYSTALLINE_TANGLER = 61564, //summons npc 32665 - SPELL_ROOTS = 28858 //proper spell id is unknown + SPELL_SPELL_REFLECTION = 47981, + SPELL_TRAMPLE = 48016, + SPELL_FRENZY = 48017, + SPELL_SUMMON_CRYSTALLINE_TANGLER = 61564, + SPELL_CRYSTAL_SPIKES = 47958, }; enum Yells { - SAY_AGGRO = -1576020, - SAY_DEATH = -1576021, - SAY_REFLECT = -1576022, - SAY_CRYSTAL_SPIKES = -1576023, - SAY_KILL = -1576024 + SAY_AGGRO = 1, + SAY_DEATH = 2, + SAY_REFLECT = 3, + SAY_CRYSTAL_SPIKES = 4, + SAY_KILL = 5, }; -enum Creatures + +enum Events { - MOB_CRYSTALLINE_TANGLER = 32665 + EVENT_CRYSTAL_SPIKES = 1, + EVENT_TRAMPLE = 2, + EVENT_SPELL_REFLECTION = 3, + EVENT_CRYSTALLINE_TANGLER = 4, }; -#define SPIKE_DISTANCE 5.0f +class OrmorokTanglerPredicate +{ + public: + OrmorokTanglerPredicate(Unit* unit) : me(unit) {} + + bool operator() (WorldObject* object) const + { + return object->GetDistance2d(me) >= 5.0f; + } + + private: + Unit* me; +}; class boss_ormorok : public CreatureScript { public: boss_ormorok() : CreatureScript("boss_ormorok") { } - CreatureAI* GetAI(Creature* creature) const + struct boss_ormorokAI : public BossAI { - return new boss_ormorokAI (creature); - } + boss_ormorokAI(Creature* creature) : BossAI(creature, DATA_ORMOROK_EVENT) {} - struct boss_ormorokAI : public ScriptedAI - { - boss_ormorokAI(Creature* creature) : ScriptedAI(creature) + void EnterCombat(Unit* /*who*/) { - instance = creature->GetInstanceScript(); - } + _EnterCombat(); - InstanceScript* instance; - - bool bFrenzy; - bool bCrystalSpikes; - uint8 uiCrystalSpikesCount; - float fBaseX; - float fBaseY; - float fBaseZ; - float fBaseO; - float fSpikeXY[4][2]; - - uint32 uiCrystalSpikesTimer; - uint32 uiCrystalSpikesTimer2; - uint32 uiTrampleTimer; - uint32 uiFrenzyTimer; - uint32 uiSpellReflectionTimer; - uint32 uiSummonCrystallineTanglerTimer; - - void Reset() - { - uiCrystalSpikesTimer = 12*IN_MILLISECONDS; - uiTrampleTimer = 10*IN_MILLISECONDS; - uiSpellReflectionTimer = 30*IN_MILLISECONDS; - uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; - bFrenzy = false; - bCrystalSpikes = false; + events.ScheduleEvent(EVENT_CRYSTAL_SPIKES, 12000); + events.ScheduleEvent(EVENT_TRAMPLE, 10000); + events.ScheduleEvent(EVENT_SPELL_REFLECTION, 30000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_CRYSTALLINE_TANGLER, 17000); + + Talk(SAY_AGGRO); if (instance) - instance->SetData(DATA_ORMOROK_EVENT, NOT_STARTED); + instance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS); } - void EnterCombat(Unit* /*who*/) + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) { - DoScriptText(SAY_AGGRO, me); - - if (instance) - instance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS); + if (!frenzy && HealthBelowPct(25)) + { + DoCast(me, SPELL_FRENZY); + frenzy = true; + } } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + _JustDied(); + + Talk(SAY_DEATH); if (instance) instance->SetData(DATA_ORMOROK_EVENT, DONE); @@ -116,195 +106,181 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void UpdateAI(const uint32 diff) { if (!UpdateVictim()) - { return; - } - if (bCrystalSpikes) - { - if (uiCrystalSpikesTimer2 <= diff) - { - fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO)); - fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO)); - fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO)); - fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO)); - fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2))); - fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2))); - fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2))); - fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2))); - for (uint8 i = 0; i < 4; ++i) - me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS); - if (++uiCrystalSpikesCount >= 13) - bCrystalSpikes = false; - uiCrystalSpikesTimer2 = 200; - } else uiCrystalSpikesTimer2 -= diff; - } - if (!bFrenzy && HealthBelowPct(25)) - { - DoCast(me, SPELL_FRENZY); - bFrenzy = true; - } + events.Update(diff); - if (uiTrampleTimer <= diff) - { - DoCast(me, SPELL_TRAMPLE); - uiTrampleTimer = 10*IN_MILLISECONDS; - } else uiTrampleTimer -= diff; - - if (uiSpellReflectionTimer <= diff) - { - DoScriptText(SAY_REFLECT, me); - DoCast(me, SPELL_SPELL_REFLECTION); - uiSpellReflectionTimer = 30*IN_MILLISECONDS; - } else uiSpellReflectionTimer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (uiCrystalSpikesTimer <= diff) - { - DoScriptText(SAY_CRYSTAL_SPIKES, me); - bCrystalSpikes = true; - uiCrystalSpikesCount = 1; - uiCrystalSpikesTimer2 = 0; - fBaseX = me->GetPositionX(); - fBaseY = me->GetPositionY(); - fBaseZ = me->GetPositionZ(); - fBaseO = me->GetOrientation(); - uiCrystalSpikesTimer = 20*IN_MILLISECONDS; - } else uiCrystalSpikesTimer -= diff; - - if (IsHeroic() && (uiSummonCrystallineTanglerTimer <= diff)) + while (uint32 eventId = events.ExecuteEvent()) { - Creature* Crystalline_Tangler = me->SummonCreature(MOB_CRYSTALLINE_TANGLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); - if (Crystalline_Tangler) + switch (eventId) { - Unit* target = NULL; - uint8 Healer = 0; - for (uint8 j = 1; j <= 4; j++) - { - switch (j) - { - case 1: Healer = CLASS_PRIEST; break; - case 2: Healer = CLASS_PALADIN; break; - case 3: Healer = CLASS_DRUID; break; - case 4: Healer = CLASS_SHAMAN; break; - } - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) - { - Unit* temp = Unit::GetUnit(*me, (*i)->getUnitGuid()); - if (temp && temp->GetTypeId() == TYPEID_PLAYER && temp->getClass() == Healer) - { - target = temp; - break; - } - } - if (target) - break; - } - if (!target) - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) - { - Crystalline_Tangler->AI()->AttackStart(target); - Crystalline_Tangler->getThreatManager().addThreat(target, 1000000000.0f); - } + case EVENT_TRAMPLE: + DoCast(me, SPELL_TRAMPLE); + events.ScheduleEvent(EVENT_TRAMPLE, 10000); + break; + case EVENT_SPELL_REFLECTION: + Talk(SAY_REFLECT); + DoCast(me, SPELL_SPELL_REFLECTION); + events.ScheduleEvent(EVENT_SPELL_REFLECTION, 30000); + break; + case EVENT_CRYSTAL_SPIKES: + Talk(SAY_CRYSTAL_SPIKES); + DoCast(SPELL_CRYSTAL_SPIKES); + events.ScheduleEvent(EVENT_CRYSTAL_SPIKES, 12000); + break; + case EVENT_CRYSTALLINE_TANGLER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, OrmorokTanglerPredicate(me))) + DoCast(target, SPELL_SUMMON_CRYSTALLINE_TANGLER); + events.ScheduleEvent(EVENT_CRYSTALLINE_TANGLER, 17000); + break; + default: + break; } - uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; - } else uiSummonCrystallineTanglerTimer -= diff; + } DoMeleeAttackIfReady(); } + + private: + bool frenzy; + }; + CreatureAI* GetAI(Creature* creature) const + { + return new boss_ormorokAI (creature); + } +}; + +enum CrystalSpikes +{ + NPC_CRYSTAL_SPIKE_INITIAL = 27101, + NPC_CRYSTAL_SPIKE_TRIGGER = 27079, + + DATA_COUNT = 1, + MAX_COUNT = 5, + + SPELL_CRYSTAL_SPIKE_DAMAGE = 47944, + + GO_CRYSTAL_SPIKE_TRAP = 188537, +}; + +uint32 const crystalSpikeSummon[3] = +{ + 47936, + 47942, + 47943 }; -class mob_crystal_spike : public CreatureScript +class npc_crystal_spike_trigger : public CreatureScript { public: - mob_crystal_spike() : CreatureScript("mob_crystal_spike") { } + npc_crystal_spike_trigger() : CreatureScript("npc_crystal_spike_trigger") { } - CreatureAI* GetAI(Creature* creature) const + struct npc_crystal_spike_triggerAI : public ScriptedAI { - return new mob_crystal_spikeAI (creature); - } + npc_crystal_spike_triggerAI(Creature* creature) : ScriptedAI(creature) {} - struct mob_crystal_spikeAI : public Scripted_NoMovementAI - { - mob_crystal_spikeAI(Creature* creature) : Scripted_NoMovementAI(creature) + void IsSummonedBy(Unit* owner) { - } + switch (me->GetEntry()) + { + case NPC_CRYSTAL_SPIKE_INITIAL: + _count = 0; + me->SetFacingToObject(owner); + break; + case NPC_CRYSTAL_SPIKE_TRIGGER: + if (Creature* trigger = owner->ToCreature()) + _count = trigger->AI()->GetData(DATA_COUNT) + 1; + break; + default: + _count = MAX_COUNT; + break; + } - uint32 SpellCrystalSpikeDamageTimer; - uint32 SpellCrystalSpikePrevisualTimer; + if (me->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER) + if (GameObject* trap = me->FindNearestGameObject(GO_CRYSTAL_SPIKE_TRAP, 1.0f)) + trap->Use(me); - void Reset() + _despawntimer = 2000; + } + + uint32 GetData(uint32 type) const { - SpellCrystalSpikeDamageTimer = 3700; - SpellCrystalSpikePrevisualTimer = 1*IN_MILLISECONDS; + return type == DATA_COUNT ? _count : 0; } void UpdateAI(const uint32 diff) { - if (SpellCrystalSpikePrevisualTimer <= diff) + if (_despawntimer <= diff) { - DoCast(me, SPELL_CRYSTAL_SPIKE_PREVISUAL); - SpellCrystalSpikePrevisualTimer = 10*IN_MILLISECONDS; - } else SpellCrystalSpikePrevisualTimer -= diff; + if (me->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER) + if (GameObject* trap = me->FindNearestGameObject(GO_CRYSTAL_SPIKE_TRAP, 1.0f)) + trap->Delete(); - if (SpellCrystalSpikeDamageTimer <= diff) - { - DoCast(me, SPELL_CRYSTALL_SPIKE_DAMAGE); - SpellCrystalSpikeDamageTimer = 10*IN_MILLISECONDS; - } else SpellCrystalSpikeDamageTimer -= diff; + me->DespawnOrUnsummon(); + } + else + _despawntimer -= diff; } - }; -}; + private: + uint32 _count; + uint32 _despawntimer; -class mob_crystalline_tangler : public CreatureScript -{ -public: - mob_crystalline_tangler() : CreatureScript("mob_crystalline_tangler") { } + }; CreatureAI* GetAI(Creature* creature) const { - return new mob_crystalline_tanglerAI (creature); + return new npc_crystal_spike_triggerAI(creature); } +}; - struct mob_crystalline_tanglerAI : public ScriptedAI - { - mob_crystalline_tanglerAI(Creature* creature) : ScriptedAI(creature) {} - - uint32 uiRootsTimer; +class spell_crystal_spike : public SpellScriptLoader +{ + public: + spell_crystal_spike() : SpellScriptLoader("spell_crystal_spike") { } - void Reset() + class spell_crystal_spike_AuraScript : public AuraScript { - uiRootsTimer = 1*IN_MILLISECONDS; - } + PrepareAuraScript(spell_crystal_spike_AuraScript); - void UpdateAI(const uint32 diff) - { - if (uiRootsTimer <= diff) + void HandlePeriodic(AuraEffect const* /*aurEff*/) { - if (me->IsWithinDist(me->getVictim(), 5.0f, false)) - { - DoCast(me->getVictim(), SPELL_ROOTS); - uiRootsTimer = 15*IN_MILLISECONDS; - } - } else uiRootsTimer -= diff; - } - }; + Unit* target = GetTarget(); + if (target->GetEntry() == NPC_CRYSTAL_SPIKE_INITIAL || target->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER) + if (Creature* trigger = target->ToCreature()) + { + uint32 spell = target->GetEntry() == NPC_CRYSTAL_SPIKE_INITIAL ? crystalSpikeSummon[0] : crystalSpikeSummon[urand(0, 2)]; + if (trigger->AI()->GetData(DATA_COUNT) < MAX_COUNT) + trigger->CastSpell(trigger, spell, true); + } + } + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_crystal_spike_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_crystal_spike_AuraScript(); + } }; void AddSC_boss_ormorok() { new boss_ormorok(); - new mob_crystal_spike(); - new mob_crystalline_tangler(); + new npc_crystal_spike_trigger(); + new spell_crystal_spike(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index 5d430ae048d..f06800cd201 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "nexus.h" +#include "Player.h" #define NUMBER_OF_ENCOUNTERS 4 @@ -153,7 +154,7 @@ public: } } - uint32 GetData(uint32 identifier) + uint32 GetData(uint32 identifier) const { switch (identifier) { @@ -220,7 +221,7 @@ public: } } - uint64 GetData64(uint32 uiIdentifier) + uint64 GetData64(uint32 uiIdentifier) const { switch (uiIdentifier) { diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index c691db4230c..4bbb4c1a5ed 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -117,7 +117,7 @@ public: _amberVoid = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 179dedb290b..51e476785ff 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "oculus.h" +#include "SpellInfo.h" enum Spells { diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index a0b5aded315..7035e0534aa 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "InstanceScript.h" #include "oculus.h" +#include "Player.h" #define MAX_ENCOUNTER 4 @@ -231,7 +232,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -243,7 +244,7 @@ public: return 0; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index f00369fd9e2..0e73e929aef 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -23,6 +23,7 @@ #include "Vehicle.h" #include "CombatAI.h" #include "oculus.h" +#include "Player.h" #define GOSSIP_ITEM_DRAKES "So where do we go from here?" #define GOSSIP_ITEM_BELGARISTRASZ1 "I want to fly on the wings of the Red Flight" diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index d964f619a6e..6f54ce50a94 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -23,6 +23,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "halls_of_lightning.h" +#include "SpellInfo.h" enum Spells { diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index fe41e7a12dc..33e6e2846e4 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -26,6 +26,8 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "halls_of_lightning.h" +#include "Player.h" +#include "SpellInfo.h" enum eEnums { diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp index 93b246e9ddc..e399c5548e3 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp @@ -174,7 +174,7 @@ public: SaveToDB(); } - uint32 GetData(uint32 uiType) + uint32 GetData(uint32 uiType) const { switch (uiType) { @@ -190,7 +190,7 @@ public: return 0; } - uint64 GetData64(uint32 uiData) + uint64 GetData64(uint32 uiData) const { switch (uiData) { diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index 28052a57576..c3e815f57dd 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -236,7 +236,7 @@ public: ++abuseTheOoze; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_ABUSE_THE_OOZE) return abuseTheOoze; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index a90c346e470..3c03508a14c 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -20,6 +20,7 @@ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "halls_of_stone.h" +#include "Player.h" enum Texts { @@ -429,7 +430,7 @@ public: brannSparklinNews = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_BRANN_SPARKLIN_NEWS) return brannSparklinNews ? 1 : 0; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp index 869cf46e74d..7a2b579dca9 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -186,7 +186,7 @@ public: SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -199,7 +199,7 @@ public: return 0; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 9d8dfa48a68..e52f1efcd73 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -24,6 +24,7 @@ #include "MapManager.h" #include "MoveSplineInit.h" #include "ulduar.h" +#include "Player.h" enum Texts { @@ -373,11 +374,11 @@ class boss_algalon_the_observer : public CreatureScript case ACTION_INIT_ALGALON: _firstPull = false; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - break;; + break; } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { return type == DATA_HAS_FED_ON_TEARS ? _fedOnTears : 1; } @@ -727,7 +728,7 @@ class npc_living_constellation : public CreatureScript _isActive = false; } - uint32 GetData(uint32 /*type*/) + uint32 GetData(uint32 /*type*/) const { return _isActive ? 1 : 0; } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index ec3125f7c0a..bfe158051b1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -178,7 +178,7 @@ class boss_auriaya : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { 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 9d5adf39817..a26f5763472 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -349,7 +349,7 @@ class boss_flame_leviathan : public CreatureScript ++Shutdown; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index a3c9cb847e5..f60922c426c 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -381,7 +381,7 @@ class boss_freya : public CreatureScript events.ScheduleEvent(EVENT_SUNBEAM, urand(5000, 15000)); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 8090b9e8a3e..1232c1b9051 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -20,6 +20,7 @@ #include "SpellScript.h" #include "SpellAuraEffects.h" #include "ulduar.h" +#include "Player.h" enum VezaxYells { @@ -234,7 +235,7 @@ class boss_general_vezax : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index 540876f421b..c0fb4e3ecc8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -154,7 +154,7 @@ class boss_ignis : public CreatureScript DoScriptText(SAY_DEATH, me); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_SHATTERED) return _shattered ? 1 : 0; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 24a9171e29f..9c77bb298a5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -21,6 +21,7 @@ #include "SpellAuraEffects.h" #include "ulduar.h" #include "Vehicle.h" +#include "Player.h" /* ScriptData SDName: boss_kologarn @@ -488,7 +489,7 @@ class spell_ulduar_squeezed_lifeless : public SpellScriptLoader pos.m_positionX = 1756.25f + irand(-3, 3); pos.m_positionY = -8.3f + irand(-3, 3); pos.m_positionZ = 448.8f; - pos.m_orientation = M_PI; + pos.SetOrientation(M_PI); GetHitPlayer()->DestroyForNearbyPlayers(); GetHitPlayer()->ExitVehicle(&pos); GetHitPlayer()->UpdateObjectVisibility(false); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index 6038b7ed9d6..5ea2678adfe 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -23,6 +23,7 @@ #include "SpellScript.h" #include "ulduar.h" #include "SpellInfo.h" +#include "Player.h" enum Says { @@ -377,7 +378,7 @@ class boss_razorscale : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_QUICK_SHAVE) if (FlyCount <= 2) @@ -895,7 +896,7 @@ class npc_darkrune_guardian : public CreatureScript killedByBreath = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { return type == DATA_IRON_DWARF_MEDIUM_RARE ? killedByBreath : 0; } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 7ada42144a8..30f60da178a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -29,6 +29,9 @@ #include "SpellAuraEffects.h" #include "ulduar.h" #include "Vehicle.h" +#include "Player.h" +#include "WorldPacket.h" +#include "Opcodes.h" enum Spells { @@ -326,7 +329,7 @@ class boss_xt002 : public CreatureScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 2f37fb06f24..7d3b943f7b0 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -19,6 +19,8 @@ #include "ScriptedCreature.h" #include "InstanceScript.h" #include "ulduar.h" +#include "Player.h" +#include "WorldPacket.h" static DoorData const doorData[] = { @@ -654,7 +656,7 @@ class instance_ulduar : public InstanceMapScript { } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { @@ -740,7 +742,7 @@ class instance_ulduar : public InstanceMapScript return 0; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp index 29eb5ad3367..ab2f778ba9d 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp @@ -20,6 +20,7 @@ #include "ScriptedGossip.h" #include "ulduar.h" #include "InstanceScript.h" +#include "Player.h" /* The teleporter appears to be active and stable. diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index e718942d091..9a50e1cbfa3 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -185,7 +185,7 @@ public: onTheRocks = value; } - uint32 GetData(uint32 data) + uint32 GetData(uint32 data) const { if (data == DATA_ON_THE_ROCKS) return onTheRocks; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 1e79cc1c5bf..c236b36312d 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "utgarde_keep.h" +#include "Player.h" #define MAX_ENCOUNTER 3 @@ -165,7 +166,7 @@ public: } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -246,7 +247,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index c694aa88338..e587a864fd6 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -143,17 +143,10 @@ public: } } } - - switch (near_f) - { - case 1: return 1; - case 2: return 2; - case 3: return 3; - default: return 0; - } + return near_f > 0 && near_f < 4 ? near_f : 0; } - void UpdateAI(const uint32 /*diff*/) + void UpdateAI(uint32 const /* diff */) { if (fm_Type == 0) fm_Type = GetForgeMasterType(); @@ -239,9 +232,115 @@ class spell_fixate : public SpellScriptLoader return new spell_fixate_SpellScript(); } }; + +enum EnslavedProtoDrake +{ + TYPE_PROTODRAKE_AT = 28, + DATA_PROTODRAKE_MOVE = 6, + + PATH_PROTODRAKE = 125946, + + EVENT_REND = 1, + EVENT_FLAME_BREATH = 2, + EVENT_KNOCKAWAY = 3, + + SPELL_REND = 43931, + SPELL_FLAME_BREATH = 50653, + SPELL_KNOCK_AWAY = 49722, + + POINT_LAST = 5, +}; + +const Position protodrakeCheckPos = {206.24f, -190.28f, 200.11f, 0.f}; + +class npc_enslaved_proto_drake : public CreatureScript +{ +public: + npc_enslaved_proto_drake() : CreatureScript("npc_enslaved_proto_drake") { } + + struct npc_enslaved_proto_drakeAI : public ScriptedAI + { + npc_enslaved_proto_drakeAI(Creature* creature) : ScriptedAI(creature) + { + _setData = false; + } + + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_REND, urand(2000, 3000)); + _events.ScheduleEvent(EVENT_FLAME_BREATH, urand(5500, 7000)); + _events.ScheduleEvent(EVENT_KNOCKAWAY, urand(3500, 6000)); + } + + void MovementInform(uint32 type, uint32 id) + { + if (type == WAYPOINT_MOTION_TYPE && id == POINT_LAST) + { + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + } + } + + void SetData(uint32 type, uint32 data) + { + if (type == TYPE_PROTODRAKE_AT && data == DATA_PROTODRAKE_MOVE && !_setData && me->GetDistance(protodrakeCheckPos) < 5.0f) + { + _setData = true; + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + me->GetMotionMaster()->MovePath(PATH_PROTODRAKE, false); + } + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventid = _events.ExecuteEvent()) + { + switch (eventid) + { + case EVENT_REND: + DoCast(SPELL_REND); + _events.ScheduleEvent(EVENT_REND, urand(15000, 20000)); + break; + case EVENT_FLAME_BREATH: + DoCast(SPELL_FLAME_BREATH); + _events.ScheduleEvent(EVENT_FLAME_BREATH, urand(11000, 12000)); + break; + case EVENT_KNOCKAWAY: + DoCast(SPELL_KNOCK_AWAY); + _events.ScheduleEvent(EVENT_KNOCKAWAY, urand(7000, 8500)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + bool _setData; + EventMap _events; + + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_enslaved_proto_drakeAI(creature); + } +}; + void AddSC_utgarde_keep() { new npc_dragonflayer_forge_master(); + new npc_enslaved_proto_drake(); new spell_ticking_time_bomb(); new spell_fixate(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index a6ad7befc38..63898e57c08 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -28,6 +28,8 @@ Script Data End */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "utgarde_pinnacle.h" +#include "Player.h" +#include "SpellInfo.h" //Yell enum eYells diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index f2f03ff602b..fc82ad1b526 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -588,7 +588,7 @@ class npc_scourge_hulk : public CreatureScript killedByRitualStrike = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { return type == DATA_INCREDIBLE_HULK ? killedByRitualStrike : 0; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 39fd01a9269..0278125deb3 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -26,6 +26,7 @@ Script Data End */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "utgarde_pinnacle.h" +#include "SpellInfo.h" enum Spells { @@ -201,7 +202,7 @@ public: kingsBane = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_KINGS_BANE) return kingsBane ? 1 : 0; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp index c5d50d4e7fd..a76c5a61109 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp @@ -180,7 +180,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -192,7 +192,7 @@ public: return 0; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index d1209b40a19..de557e10e7f 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -62,7 +62,7 @@ class instance_archavon : public InstanceMapScript } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index f6d918e0493..cea00417233 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -197,7 +197,7 @@ public: me->GetMotionMaster()->MoveChase(me->getVictim()); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_DEHYDRATION) return dehydration ? 1 : 0; diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index a01b41bfbcf..58d7b59c7dd 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "violet_hold.h" +#include "Player.h" enum Spells { diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index d1c65259738..408a7083383 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -158,7 +158,7 @@ public: voidDance = false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_VOID_DANCE) return voidDance ? 1 : 0; diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 4b6fed181e4..5e3bbc01025 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "violet_hold.h" +#include "Player.h" +#include "TemporarySummon.h" #define MAX_ENCOUNTER 3 @@ -417,7 +419,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -438,7 +440,7 @@ public: return 0; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 870ea893b78..c73cb97f2d1 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -20,6 +20,7 @@ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "violet_hold.h" +#include "Player.h" #define GOSSIP_START_EVENT "Get your people to safety, we'll keep the Blue Dragonflight's forces at bay." #define GOSSIP_ITEM_1 "Activate the crystals when we get in trouble, right" diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index 224d06e9d3c..6eed82991b8 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -42,6 +42,9 @@ EndContentData */ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "ScriptedFollowerAI.h" +#include "Player.h" +#include "SpellInfo.h" +#include "WorldSession.h" /*###### ## npc_sinkhole_kill_credit diff --git a/src/server/scripts/Northrend/crystalsong_forest.cpp b/src/server/scripts/Northrend/crystalsong_forest.cpp index 7b8eb331702..09df0acc467 100644 --- a/src/server/scripts/Northrend/crystalsong_forest.cpp +++ b/src/server/scripts/Northrend/crystalsong_forest.cpp @@ -25,6 +25,7 @@ Script Data End */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" /******************************************************* * npc_warmage_violetstand @@ -108,4 +109,4 @@ public: void AddSC_crystalsong_forest() { new npc_warmage_violetstand; -}
\ No newline at end of file +} diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index c19effbab1b..b662442ef93 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -26,6 +26,8 @@ Script Data End */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "WorldSession.h" /******************************************************* * npc_mageguard_dalaran diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp index a26ee4e9270..13a8370690e 100644 --- a/src/server/scripts/Northrend/dragonblight.cpp +++ b/src/server/scripts/Northrend/dragonblight.cpp @@ -33,6 +33,7 @@ EndContentData */ #include "SpellScript.h" #include "SpellAuraEffects.h" #include "ScriptedEscortAI.h" +#include "Player.h" enum eEnums { diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 4ca12bc82a1..0363e0c892d 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -19,6 +19,8 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ## Quest 12027: Mr. Floppy's Perilous Adventure diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp index ffe38d6aade..e04531954ea 100644 --- a/src/server/scripts/Northrend/howling_fjord.cpp +++ b/src/server/scripts/Northrend/howling_fjord.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_apothecary_hanes diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp index 5989b5bad2e..030df23028c 100644 --- a/src/server/scripts/Northrend/icecrown.cpp +++ b/src/server/scripts/Northrend/icecrown.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "SpellAuras.h" +#include "Player.h" /*###### ## npc_arete diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp index 1cf8f54b4fe..88d262a1579 100644 --- a/src/server/scripts/Northrend/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/isle_of_conquest.cpp @@ -19,6 +19,7 @@ #include "ScriptedCreature.h" #include "PassiveAI.h" #include "BattlegroundIC.h" +#include "Player.h" // TO-DO: This should be done with SmartAI, but yet it does not correctly support vehicles's AIs. // Even adding ReactState Passive we still have issues using SmartAI. diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 63960f13bb7..8404413ad9d 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -34,6 +34,7 @@ EndContentData */ #include "ScriptedEscortAI.h" #include "SpellScript.h" #include "SpellAuras.h" +#include "Player.h" /*###### ## npc_injured_rainspeaker_oracle diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 1733af17580..b3a379d903d 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -23,6 +23,8 @@ #include "SpellAuraEffects.h" #include "Vehicle.h" #include "CombatAI.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## npc_agnetta_tyrsdottar diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index b7901f1a44a..8935c77b30e 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -25,6 +25,7 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "SpellScript.h" +#include "Player.h" #define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO2 "Build demolisher." diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index 6af96f3fdfd..e5763e5baf6 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -19,6 +19,8 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "SpellInfo.h" /*#### ## npc_drakuru_shackles diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index c70e4168826..9411bd8a363 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -23,6 +23,7 @@ #include "MapManager.h" #include "ObjectMgr.h" #include "OutdoorPvPMgr.h" +#include "ReputationMgr.h" #include "Language.h" #include "World.h" diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index f678cf9c198..d6465bfe006 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" #define SPELL_INHIBITMAGIC 32264 #define SPELL_ATTRACTMAGIC 32265 diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index a1780d1d4a8..303a30bea8f 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "shadow_labyrinth.h" +#include "Player.h" #define SAY_INTRO -1555028 #define SAY_AGGRO1 -1555029 diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index 0f3bcce6493..1503c9f7234 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "shadow_labyrinth.h" +#include "SpellInfo.h" #define EMOTE_SONIC_BOOM -1555036 diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index 9facb42107b..9fa90be9765 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -179,7 +179,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -191,7 +191,7 @@ public: return false; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { if (identifier == DATA_GRANDMASTERVORPIL) return m_uiGrandmasterVorpil; diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index 5fe5b8aab0c..a100f5848af 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -29,8 +29,9 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" - #include "ScriptedGossip.h" +#include "ScriptedGossip.h" #include "black_temple.h" +#include "Player.h" /*### # npc_spirit_of_olum diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index f812b1b35cd..1029648561f 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -28,6 +28,8 @@ EndScriptData */ #include "ScriptedGossip.h" #include "PassiveAI.h" #include "black_temple.h" +#include "Player.h" +#include "SpellInfo.h" #define GETGO(obj, guid) GameObject* obj = instance->instance->GetGameObject(guid) #define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*me, guid) diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 2757a862c93..6e770249cf0 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "black_temple.h" +#include "Player.h" #define SAY_DEATH -1564013 #define SAY_LOW_HEALTH -1564014 diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index e8bee95865f..9924bf1ffab 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -26,6 +26,8 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "black_temple.h" +#include "Player.h" +#include "SpellInfo.h" enum eEnums { diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index 98d90aa1818..8a2e25b176a 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "black_temple.h" +#include "Player.h" #define MAX_ENCOUNTER 9 @@ -237,7 +238,7 @@ public: } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -347,7 +348,7 @@ public: } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 3b94feda02b..a934d03349c 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -27,6 +27,8 @@ EndScriptData */ #include "ScriptedCreature.h" #include "serpent_shrine.h" #include "Spell.h" +#include "Player.h" +#include "WorldSession.h" #define SAY_INTRO -1548042 #define SAY_AGGRO1 -1548043 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 9b739a1a6ac..1221e59b96e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "serpent_shrine.h" +#include "Player.h" // --- Spells used by Leotheras The Blind #define SPELL_WHIRLWIND 37640 @@ -103,7 +104,7 @@ public: victimGUID = guid; } - uint64 GetGUID(int32 id/* = 0 */) + uint64 GetGUID(int32 id/* = 0 */) const { if (id == INNER_DEMON_VICTIM) return victimGUID; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index b9e530996af..5bc2344fd70 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "serpent_shrine.h" #include "Spell.h" +#include "Player.h" #define SPELL_SPOUT 37433 #define SPELL_SPOUT_ANIM 42835 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 87053d1de1c..4af38888758 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -26,6 +26,8 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "serpent_shrine.h" +#include "Player.h" +#include "TemporarySummon.h" #define MAX_ENCOUNTER 6 #define SPELL_SCALDINGWATER 37284 @@ -242,7 +244,7 @@ class instance_serpent_shrine : public InstanceMapScript LeotherasEventStarter = data; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -340,7 +342,7 @@ class instance_serpent_shrine : public InstanceMapScript SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index d81a021c4bc..ac730292545 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "steam_vault.h" +#include "SpellInfo.h" #define SAY_INTRO -1545016 #define SAY_REGEN -1545017 diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index dd0b5ea9160..e8a096a83a1 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -167,7 +167,7 @@ public: SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -183,7 +183,7 @@ public: return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index fa67659ca66..120e550bd4e 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -117,7 +117,7 @@ public: MaulgarEvent_Tank = data; } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -156,7 +156,7 @@ public: SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index 233a8d82497..11e75f054ad 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -175,7 +175,7 @@ class instance_blood_furnace : public InstanceMapScript BroggokLeverGUID = go->GetGUID(); //Broggok lever } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { @@ -231,7 +231,7 @@ class instance_blood_furnace : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp index 714ea275471..56365216be5 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" enum eSays { diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 3bb0858d2be..f0c4330c9a3 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellInfo.h" enum eSpells { diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index bbf03e39f9b..94272e4a50f 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -26,6 +26,8 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "magtheridons_lair.h" +#include "Player.h" +#include "SpellInfo.h" struct Yell { diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index 640e4439593..0bb949d3b90 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -123,7 +123,7 @@ class instance_magtheridons_lair : public InstanceMapScript } } - uint64 GetData64(uint32 type) + uint64 GetData64(uint32 type) const { switch (type) { @@ -211,7 +211,7 @@ class instance_magtheridons_lair : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { if (type == DATA_MAGTHERIDON_EVENT) return m_auiEncounter[0]; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp index 4105a7d5821..c7c1cbba880 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp @@ -87,7 +87,7 @@ class instance_shattered_halls : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -99,7 +99,7 @@ class instance_shattered_halls : public InstanceMapScript return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 3770ac3ba09..a8be934c710 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "the_eye.h" +#include "SpellInfo.h" enum eSpells { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 29c87e57c83..2dbfb7b46c5 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "the_eye.h" #include "WorldPacket.h" +#include "Opcodes.h" enum eEnums { @@ -926,8 +927,7 @@ class boss_kaelthas : public CreatureScript unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, me->GetGUID()); //Using packet workaround - WorldPacket data(12); - data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); + WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12); data.append(unit->GetPackGUID()); data << uint32(0); unit->SendMessageToSet(&data, true); @@ -953,8 +953,7 @@ class boss_kaelthas : public CreatureScript if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid())) { //Using packet workaround - WorldPacket data(12); - data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); + WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12); data.append(unit->GetPackGUID()); data << uint32(0); unit->SendMessageToSet(&data, true); diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 1230b7e88cf..e9ee5a62bb8 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -113,7 +113,7 @@ class instance_the_eye : public InstanceMapScript } } - uint64 GetData64(uint32 identifier) + uint64 GetData64(uint32 identifier) const { switch (identifier) { @@ -151,7 +151,7 @@ class instance_the_eye : public InstanceMapScript SaveToDB(); } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index d2b0475fa77..697d2c9f9f9 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -20,6 +20,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" +#include "Player.h" enum Spells { diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index a96666705d1..37e314b6576 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -57,7 +57,7 @@ class instance_mechanar : public InstanceMapScript return false; } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -67,7 +67,7 @@ class instance_mechanar : public InstanceMapScript return false; } - uint64 GetData64(uint32 /*identifier*/) + uint64 GetData64(uint32 /*identifier*/) const { return 0; } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index d5b61b87fc2..e956ea0ed85 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -230,7 +230,7 @@ class instance_arcatraz : public InstanceMapScript } } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { switch (type) { @@ -244,7 +244,7 @@ class instance_arcatraz : public InstanceMapScript return 0; } - uint64 GetData64(uint32 data) + uint64 GetData64(uint32 data) const { switch (data) { diff --git a/src/server/scripts/Outland/hellfire_peninsula.cpp b/src/server/scripts/Outland/hellfire_peninsula.cpp index 4c44d4e828e..4da98281eb2 100644 --- a/src/server/scripts/Outland/hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/hellfire_peninsula.cpp @@ -37,6 +37,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## npc_aeranas diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index 977ec57e2df..0c9a60603f5 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -32,6 +32,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "SpellInfo.h" /*###### ## npc_greatmother_geyah diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 8533491c15f..eaea4960712 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -36,6 +36,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" /*###### ## npc_manaforge_control_console diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index c84df2ee3d4..dc91fb2c14f 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -46,6 +46,8 @@ EndContentData */ #include "ScriptedEscortAI.h" #include "Group.h" #include "SpellScript.h" +#include "Player.h" +#include "WorldSession.h" /*##### # mob_mature_netherwing_drake diff --git a/src/server/scripts/Outland/shattrath_city.cpp b/src/server/scripts/Outland/shattrath_city.cpp index 8ad2c311fc5..76cffa9e1fe 100644 --- a/src/server/scripts/Outland/shattrath_city.cpp +++ b/src/server/scripts/Outland/shattrath_city.cpp @@ -38,6 +38,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## npc_raliq_the_drunk diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp index 707cabfcf0c..2298f676692 100644 --- a/src/server/scripts/Outland/terokkar_forest.cpp +++ b/src/server/scripts/Outland/terokkar_forest.cpp @@ -38,6 +38,8 @@ EndContentData */ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "Group.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## mob_unkor_the_ruthless diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp index a48866a2f83..03e40b8d7dc 100644 --- a/src/server/scripts/Outland/zangarmarsh.cpp +++ b/src/server/scripts/Outland/zangarmarsh.cpp @@ -36,6 +36,8 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## npcs_ashyen_and_keleth diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index b46d2083ecd..224e909ca57 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_dk_". */ +#include "Player.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 6119c9050fa..0fe6c367a9a 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_dru_". */ +#include "Player.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 519d79add6d..026a0c7b280 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -23,16 +23,19 @@ */ #include "ScriptMgr.h" -#include "SpellScript.h" -#include "SpellAuraEffects.h" -#include "SkillDiscovery.h" +#include "Battleground.h" #include "Cell.h" #include "CellImpl.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "InstanceScript.h" #include "Group.h" +#include "InstanceScript.h" #include "LFGMgr.h" +#include "Pet.h" +#include "ReputationMgr.h" +#include "SkillDiscovery.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader { diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index a1ecac6256a..5b1cbe0c36a 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -20,6 +20,7 @@ * Scriptnames in this file should be prefixed with "spell_#holidayname_". */ +#include "Player.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 9d0e084cfb8..a73af6892ca 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_hun_". */ +#include "Pet.h" #include "ScriptMgr.h" #include "Cell.h" #include "CellImpl.h" diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index ef810b50b6f..e0c88ad6846 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -21,11 +21,13 @@ * Scriptnames of files in this file should be prefixed with "spell_item_". */ +#include "Player.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" #include "SpellAuraEffects.h" #include "SkillDiscovery.h" +#include "Battleground.h" // Generic script for handling item dummy effects which trigger another spell. class spell_item_trigger_spell : public SpellScriptLoader diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index f4bbccc8587..cd096ebed5e 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -21,11 +21,11 @@ * Scriptnames of files in this file should be prefixed with "spell_mage_". */ +#include "Player.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" - enum MageSpells { SPELL_MAGE_COLD_SNAP = 11958, diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 41bda3c163d..58f94edb387 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -21,12 +21,12 @@ * Scriptnames of files in this file should be prefixed with "spell_pal_". */ +#include "Player.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" #include "Group.h" - enum PaladinSpells { PALADIN_SPELL_DIVINE_PLEA = 54428, diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index df6c311ca67..876d7c80a44 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -1706,7 +1706,7 @@ public: if (pet->isGuardian()) ((Guardian*)pet)->SetBonusDamage(owner->GetTotalAttackPowerValue(BASE_ATTACK)); - amount += owner->CalculateDamage(BASE_ATTACK, true, true);; + amount += owner->CalculateDamage(BASE_ATTACK, true, true); } } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index aee3889e93b..a15eb7ddc2c 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_pri_". */ +#include "Player.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 06d3602d8e8..da80ec8f1da 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_q#questID_". */ +#include "Player.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 68cc50a3022..0294533bdcd 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_rog_". */ +#include "Player.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index e107ea954e4..1ba962982e4 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_sha_". */ +#include "Player.h" #include "ScriptMgr.h" #include "GridNotifiers.h" #include "Unit.h" diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index aa56f8300bc..f83056aa8b6 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_warl_". */ +#include "Player.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index cc8dbe35703..613bf0fef5d 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -21,6 +21,7 @@ * Scriptnames of files in this file should be prefixed with "spell_warr_". */ +#include "Player.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index a6f4f7f64f9..178df2078f8 100755 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -23,6 +23,8 @@ #include "BattlegroundSA.h" #include "BattlegroundAV.h" #include "Vehicle.h" +#include "Player.h" +#include "Creature.h" class achievement_resilient_victory : public AchievementCriteriaScript { diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index 67aeda314bf..db3c6dd2274 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -37,6 +37,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Player.h" /*###### ## at_coilfang_waterfall diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index ddb0044a888..dac67b566e3 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -55,6 +55,8 @@ EndContentData */ #include "ScriptedGossip.h" #include "GameObjectAI.h" #include "Spell.h" +#include "Player.h" +#include "WorldSession.h" /*###### ## go_cat_figurine diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index 4b0433fe0c7..951c0ed9688 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -32,6 +32,8 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "GuardAI.h" +#include "Player.h" +#include "SpellInfo.h" enum GuardGeneric { diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index d888e6cb56b..535bebd9415 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -33,6 +33,7 @@ EndContentData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "Spell.h" +#include "Player.h" /*##### # item_only_for_flight diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp index f57af517db2..502ecb1acb2 100644 --- a/src/server/scripts/World/npc_innkeeper.cpp +++ b/src/server/scripts/World/npc_innkeeper.cpp @@ -27,6 +27,8 @@ EndScriptData */ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "GameEventMgr.h" +#include "Player.h" +#include "WorldSession.h" #define HALLOWEEN_EVENTID 12 #define SPELL_TRICK_OR_TREATED 24755 diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 175cfb190d7..4e0818c7c82 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -26,6 +26,9 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "SpellInfo.h" +#include "WorldSession.h" /* A few notes for future developement: diff --git a/src/server/scripts/World/npc_taxi.cpp b/src/server/scripts/World/npc_taxi.cpp index 18f776e7171..4ed5b0d9276 100644 --- a/src/server/scripts/World/npc_taxi.cpp +++ b/src/server/scripts/World/npc_taxi.cpp @@ -27,6 +27,8 @@ EndScriptData #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "Player.h" +#include "WorldSession.h" #define GOSSIP_SUSURRUS "I am ready." #define GOSSIP_NETHER_DRAKE "I'm ready to fly! Take me up, dragon!" diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 4f0687ef11d..b38530b2a4a 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -58,6 +58,7 @@ EndContentData */ #include "Cell.h" #include "CellImpl.h" #include "SpellAuras.h" +#include "Pet.h" /*######## # npc_air_force_bots @@ -2284,7 +2285,7 @@ class npc_wormhole : public CreatureScript _showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though } - uint32 GetData(uint32 type) + uint32 GetData(uint32 type) const { return (type == DATA_SHOW_UNDERGROUND && _showUnderground) ? 1 : 0; } |
