aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp66
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp2
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp44
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp28
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/zone_ghostlands.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/zone_hinterlands.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_undercity.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/zone_wetlands.cpp1
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp4
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp10
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp2
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp7
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp13
-rw-r--r--src/server/scripts/Kalimdor/zone_ashenvale.cpp5
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp8
-rw-r--r--src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp3
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp9
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp5
-rw-r--r--src/server/scripts/Kalimdor/zone_winterspring.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp5
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp102
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp6
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp15
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp22
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp2117
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp61
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h76
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp9
-rw-r--r--src/server/scripts/Northrend/northrend_script_loader.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_borean_tundra.cpp13
-rw-r--r--src/server/scripts/Northrend/zone_dragonblight.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp4
-rw-r--r--src/server/scripts/Northrend/zone_howling_fjord.cpp3
-rw-r--r--src/server/scripts/Northrend/zone_icecrown.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_sholazar_basin.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_storm_peaks.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_zuldrak.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.h1
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp5
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp10
-rw-r--r--src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp2
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp10
-rw-r--r--src/server/scripts/Outland/zone_nagrand.cpp4
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp4
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp21
-rw-r--r--src/server/scripts/Outland/zone_shattrath_city.cpp7
-rw-r--r--src/server/scripts/Outland/zone_terokkar_forest.cpp14
-rw-r--r--src/server/scripts/Outland/zone_zangarmarsh.cpp5
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp41
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp4
102 files changed, 2608 insertions, 401 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 11417b305a5..81bc3e533e1 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -61,6 +61,7 @@ public:
{ "cinematic", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY_CINEMATIC, false, &HandleDebugPlayCinematicCommand, "" },
{ "movie", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY_MOVIE, false, &HandleDebugPlayMovieCommand, "" },
{ "sound", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY_SOUND, false, &HandleDebugPlaySoundCommand, "" },
+ { "music", rbac::RBAC_PERM_COMMAND_DEBUG_PLAY_MUSIC, false, &HandleDebugPlayMusicCommand, "" },
};
static std::vector<ChatCommand> debugSendCommandTable =
{
@@ -117,8 +118,8 @@ public:
static bool HandleDebugPlayCinematicCommand(ChatHandler* handler, char const* args)
{
- // USAGE: .debug play cinematic #cinematicid
- // #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
+ // USAGE: .debug play cinematic #cinematicId
+ // #cinematicId - ID decimal number from CinemaicSequences.dbc (1st column)
if (!*args)
{
handler->SendSysMessage(LANG_BAD_VALUE);
@@ -126,12 +127,12 @@ public:
return false;
}
- uint32 id = atoul(args);
+ uint32 cinematicId = atoul(args);
- CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(id);
+ CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
if (!cineSeq)
{
- handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, id);
+ handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
handler->SetSentErrorMessage(true);
return false;
}
@@ -139,7 +140,7 @@ public:
// Dump camera locations
if (std::vector<FlyByCamera> const* flyByCameras = GetFlyByCameras(cineSeq->Camera[0]))
{
- handler->PSendSysMessage("Waypoints for sequence %u, camera %u", id, cineSeq->Camera[0]);
+ handler->PSendSysMessage("Waypoints for sequence %u, camera %u", cinematicId, cineSeq->Camera[0]);
uint32 count = 1;
for (FlyByCamera const& cam : *flyByCameras)
{
@@ -149,14 +150,14 @@ public:
handler->PSendSysMessage(SZFMTD " waypoints dumped", flyByCameras->size());
}
- handler->GetSession()->GetPlayer()->SendCinematicStart(id);
+ handler->GetSession()->GetPlayer()->SendCinematicStart(cinematicId);
return true;
}
static bool HandleDebugPlayMovieCommand(ChatHandler* handler, char const* args)
{
- // USAGE: .debug play movie #movieid
- // #movieid - ID decimal number from Movie.dbc (1st column)
+ // USAGE: .debug play movie #movieId
+ // #movieId - ID decimal number from Movie.dbc (1st column)
if (!*args)
{
handler->SendSysMessage(LANG_BAD_VALUE);
@@ -164,24 +165,24 @@ public:
return false;
}
- uint32 id = atoul(args);
+ uint32 movieId = atoul(args);
- if (!sMovieStore.LookupEntry(id))
+ if (!sMovieStore.LookupEntry(movieId))
{
- handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, id);
+ handler->PSendSysMessage(LANG_MOVIE_NOT_EXIST, movieId);
handler->SetSentErrorMessage(true);
return false;
}
- handler->GetSession()->GetPlayer()->SendMovieStart(id);
+ handler->GetSession()->GetPlayer()->SendMovieStart(movieId);
return true;
}
//Play sound
static bool HandleDebugPlaySoundCommand(ChatHandler* handler, char const* args)
{
- // USAGE: .debug playsound #soundid
- // #soundid - ID decimal number from SoundEntries.dbc (1st column)
+ // USAGE: .debug playsound #soundId
+ // #soundId - ID decimal number from SoundEntries.dbc (1st column)
if (!*args)
{
handler->SendSysMessage(LANG_BAD_VALUE);
@@ -198,6 +199,8 @@ public:
return false;
}
+ Player* player = handler->GetSession()->GetPlayer();
+
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
@@ -206,15 +209,42 @@ public:
return false;
}
- if (!handler->GetSession()->GetPlayer()->GetTarget().IsEmpty())
- unit->PlayDistanceSound(soundId, handler->GetSession()->GetPlayer());
+ if (player->GetTarget().IsEmpty())
+ unit->PlayDistanceSound(soundId, player);
else
- unit->PlayDirectSound(soundId, handler->GetSession()->GetPlayer());
+ unit->PlayDirectSound(soundId, player);
handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, soundId);
return true;
}
+ static bool HandleDebugPlayMusicCommand(ChatHandler* handler, char const* args)
+ {
+ // USAGE: .debug play music #musicId
+ // #musicId - ID decimal number from SoundEntries.dbc (1st column)
+ if (!*args)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 musicId = atoul(args);
+ if (!sSoundKitStore.LookupEntry(musicId))
+ {
+ handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, musicId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ player->PlayDirectMusic(musicId, player);
+
+ handler->PSendSysMessage(LANG_YOU_HEAR_SOUND, musicId);
+ return true;
+ }
+
static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, char const* args)
{
if (!*args)
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 595af9223bc..4d818db8f9d 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -891,7 +891,7 @@ public:
const_cast<CreatureData*>(data)->posZ = z;
const_cast<CreatureData*>(data)->orientation = o;
}
- creature->SetPosition(x, y, z, o);
+ creature->UpdatePosition(x, y, z, o);
creature->GetMotionMaster()->Initialize();
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
{
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 8917a50951f..ccb032f6c02 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -111,13 +111,13 @@ public:
{ "item_random_bonus_list_template", rbac::RBAC_PERM_COMMAND_RELOAD_ITEM_RANDOM_BONUS_LIST_TEMPLATE, true, &HandleReloadItemRandomBonusListTemplatesCommand, "" },
{ "item_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_ITEM_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesItemCommand, "" },
{ "lfg_dungeon_rewards", rbac::RBAC_PERM_COMMAND_RELOAD_LFG_DUNGEON_REWARDS, true, &HandleReloadLfgRewardsCommand, "" },
- { "locales_achievement_reward", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_ACHIEVEMENT_REWARD, true, &HandleReloadLocalesAchievementRewardCommand, "" },
- { "locales_creature", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_CRETURE, true, &HandleReloadLocalesCreatureCommand, "" },
- { "locales_creature_text", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_CRETURE_TEXT, true, &HandleReloadLocalesCreatureTextCommand, "" },
- { "locales_gameobject", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_GAMEOBJECT, true, &HandleReloadLocalesGameobjectCommand, "" },
- { "locales_gossip_menu_option", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_GOSSIP_MENU_OPTION, true, &HandleReloadLocalesGossipMenuOptionCommand, "" },
- { "locales_page_text", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_PAGE_TEXT, true, &HandleReloadLocalesPageTextCommand, "" },
- { "locales_points_of_interest", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_POINTS_OF_INTEREST, true, &HandleReloadLocalesPointsOfInterestCommand, "" },
+ { "achievement_reward_locale", rbac::RBAC_PERM_COMMAND_RELOAD_ACHIEVEMENT_REWARD_LOCALE, true, &HandleReloadLocalesAchievementRewardCommand, "" },
+ { "creature_template_locale", rbac::RBAC_PERM_COMMAND_RELOAD_CRETURE_TEMPLATE_LOCALE, true, &HandleReloadLocalesCreatureCommand, "" },
+ { "creature_text_locale", rbac::RBAC_PERM_COMMAND_RELOAD_CRETURE_TEXT_LOCALE, true, &HandleReloadLocalesCreatureTextCommand, "" },
+ { "gameobject_template_locale", rbac::RBAC_PERM_COMMAND_RELOAD_GAMEOBJECT_TEMPLATE_LOCALE, true, &HandleReloadLocalesGameobjectCommand, "" },
+ { "gossip_menu_option_locale", rbac::RBAC_PERM_COMMAND_RELOAD_GOSSIP_MENU_OPTION_LOCALE, true, &HandleReloadLocalesGossipMenuOptionCommand, "" },
+ { "page_text_locale", rbac::RBAC_PERM_COMMAND_RELOAD_PAGE_TEXT_LOCALE, true, &HandleReloadLocalesPageTextCommand, "" },
+ { "points_of_interest_locale", rbac::RBAC_PERM_COMMAND_RELOAD_POINTS_OF_INTEREST_LOCALE, true, &HandleReloadLocalesPointsOfInterestCommand, "" },
{ "mail_level_reward", rbac::RBAC_PERM_COMMAND_RELOAD_MAIL_LEVEL_REWARD, true, &HandleReloadMailLevelRewardCommand, "" },
{ "mail_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_MAIL_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesMailCommand, "" },
{ "milling_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_MILLING_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesMillingCommand, "" },
@@ -128,7 +128,7 @@ public:
{ "points_of_interest", rbac::RBAC_PERM_COMMAND_RELOAD_POINTS_OF_INTEREST, true, &HandleReloadPointsOfInterestCommand, "" },
{ "prospecting_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_PROSPECTING_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesProspectingCommand, "" },
{ "quest_greeting", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_GREETING, true, &HandleReloadQuestGreetingCommand, "" },
- { "quest_locale", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_LOCALE, true, &HandleReloadQuestLocaleCommand, "" },
+ { "quest_locale", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_TEMPLATE_LOCALE, true, &HandleReloadQuestLocaleCommand, "" },
{ "quest_poi", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_POI, true, &HandleReloadQuestPOICommand, "" },
{ "quest_template", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_TEMPLATE, true, &HandleReloadQuestTemplateCommand, "" },
{ "rbac", rbac::RBAC_PERM_COMMAND_RELOAD_RBAC, true, &HandleReloadRBACCommand, "" },
@@ -997,9 +997,9 @@ public:
static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- TC_LOG_INFO("misc", "Re-Loading Locales Achievement Reward Data...");
+ TC_LOG_INFO("misc", "Re-Loading Achievement Reward Data Locale...");
sAchievementMgr->LoadRewardLocales();
- handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded.");
+ handler->SendGlobalGMSysMessage("DB table `achievement_reward_locale` reloaded.");
return true;
}
@@ -1013,49 +1013,49 @@ public:
static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/)
{
- TC_LOG_INFO("misc", "Re-Loading Locales Creature ...");
+ TC_LOG_INFO("misc", "Re-Loading Creature Template Locale...");
sObjectMgr->LoadCreatureLocales();
- handler->SendGlobalGMSysMessage("DB table `locales_creature` reloaded.");
+ handler->SendGlobalGMSysMessage("DB table `creature_template_locale` reloaded.");
return true;
}
static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/)
{
- TC_LOG_INFO("misc", "Re-Loading Locales Creature Texts...");
+ TC_LOG_INFO("misc", "Re-Loading Creature Texts Locale...");
sCreatureTextMgr->LoadCreatureTextLocales();
- handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded.");
+ handler->SendGlobalGMSysMessage("DB table `creature_text_locale` reloaded.");
return true;
}
static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
{
- TC_LOG_INFO("misc", "Re-Loading Locales Gameobject ... ");
+ TC_LOG_INFO("misc", "Re-Loading Gameobject Template Locale... ");
sObjectMgr->LoadGameObjectLocales();
- handler->SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded.");
+ handler->SendGlobalGMSysMessage("DB table `gameobject_template_locale` reloaded.");
return true;
}
static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
{
- TC_LOG_INFO("misc", "Re-Loading Locales Gossip Menu Option ... ");
+ TC_LOG_INFO("misc", "Re-Loading Gossip Menu Option Locale... ");
sObjectMgr->LoadGossipMenuItemsLocales();
- handler->SendGlobalGMSysMessage("DB table `locales_gossip_menu_option` reloaded.");
+ handler->SendGlobalGMSysMessage("DB table `gossip_menu_option_locale` reloaded.");
return true;
}
static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/)
{
- TC_LOG_INFO("misc", "Re-Loading Locales Page Text ... ");
+ TC_LOG_INFO("misc", "Re-Loading Page Text Locale... ");
sObjectMgr->LoadPageTextLocales();
- handler->SendGlobalGMSysMessage("DB table `locales_page_text` reloaded.");
+ handler->SendGlobalGMSysMessage("DB table `page_text_locale` reloaded.");
return true;
}
static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
{
- TC_LOG_INFO("misc", "Re-Loading Locales Points Of Interest ... ");
+ TC_LOG_INFO("misc", "Re-Loading Points Of Interest Locale... ");
sObjectMgr->LoadPointOfInterestLocales();
- handler->SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded.");
+ handler->SendGlobalGMSysMessage("DB table `points_of_interest_locale` reloaded.");
return true;
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
index 3851a74d263..14c6ec900db 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
@@ -588,7 +588,7 @@ public:
//spell by trap has effect61, this indicate the bar go hostile
if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PHALANX)))
- tmp->SetFaction(14);
+ tmp->SetFaction(FACTION_MONSTER);
//for later, this event(s) has alot more to it.
//optionally, DONE can trigger bar to go hostile.
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
index 923b771b04b..39cf1b6345a 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
@@ -99,8 +99,6 @@ enum DirebrewEvents
enum DirebrewMisc
{
- COREN_DIREBREW_FACTION_HOSTILE = 736,
- COREN_DIREBREW_FACTION_FRIEND = 35,
GOSSIP_ID = 11388,
GO_MOLE_MACHINE_TRAP = 188509,
GOSSIP_OPTION_FIGHT = 0,
@@ -145,7 +143,7 @@ public:
{
_Reset();
me->AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
- me->SetFaction(COREN_DIREBREW_FACTION_FRIEND);
+ me->SetFaction(FACTION_FRIENDLY);
events.SetPhase(PHASE_ALL);
for (uint8 i = 0; i < MAX_ANTAGONISTS; ++i)
@@ -168,7 +166,7 @@ public:
{
events.SetPhase(PHASE_ONE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
- me->SetFaction(COREN_DIREBREW_FACTION_HOSTILE);
+ me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
me->SetInCombatWithZone();
EntryCheckPredicate pred(NPC_ANTAGONIST);
@@ -359,7 +357,7 @@ public:
void Reset() override
{
- me->SetFaction(COREN_DIREBREW_FACTION_HOSTILE);
+ me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
DoCastAOE(SPELL_MOLE_MACHINE_EMERGE, true);
me->SetInCombatWithZone();
}
@@ -401,7 +399,7 @@ public:
break;
case ACTION_ANTAGONIST_HOSTILE:
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
- me->SetFaction(COREN_DIREBREW_FACTION_HOSTILE);
+ me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
me->SetInCombatWithZone();
break;
default:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
index 9015420d079..5017f5e48bd 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
@@ -75,7 +75,7 @@ class boss_emperor_dagran_thaurissan : public CreatureScript
if (Creature* moira = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MOIRA)))
{
moira->AI()->EnterEvadeMode();
- moira->SetFaction(35);
+ moira->SetFaction(FACTION_FRIENDLY);
}
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
index d5af35b77b0..7d709fdaf42 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
@@ -149,7 +149,7 @@ class boss_doomrel : public CreatureScript
{
Initialize();
- me->SetFaction(FACTION_FRIEND);
+ me->SetFaction(FACTION_FRIENDLY);
// was set before event start, so set again
me->AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
@@ -239,7 +239,7 @@ class boss_doomrel : public CreatureScript
case GOSSIP_ACTION_INFO_DEF + 2:
CloseGossipMenuFor(player);
//start event here
- me->SetFaction(FACTION_HOSTILE);
+ me->SetFaction(FACTION_DARK_IRON_DWARVES);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->AI()->AttackStart(player);
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
index 219414e29a7..85a38917f2b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
@@ -354,7 +354,7 @@ public:
{
if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter]))
{
- boss->SetFaction(FACTION_HOSTILE);
+ boss->SetFaction(FACTION_DARK_IRON_DWARVES);
boss->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
if (Unit* target = boss->SelectNearestTarget(500))
boss->AI()->AttackStart(target);
@@ -380,7 +380,7 @@ public:
boss->GetMotionMaster()->MoveTargetedHome();
boss->SetLootRecipient(NULL);
}
- boss->SetFaction(FACTION_FRIEND);
+ boss->SetFaction(FACTION_FRIENDLY);
}
}
GhostKillCount = 0;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
index e5c2d97a9d4..f9f81e46efe 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
@@ -190,7 +190,7 @@ public:
me->SetVisible(true);
me->SetNpcFlags(UNIT_NPC_FLAG_GOSSIP);
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->SetStandState(UNIT_STAND_STATE_SIT_HIGH_CHAIR);
me->RemoveAura(SPELL_NEFARIANS_BARRIER);
}
@@ -207,7 +207,7 @@ public:
Talk(SAY_GAMESBEGIN_2);
- me->SetFaction(103);
+ me->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
me->SetNpcFlags(UNIT_NPC_FLAG_NONE);
DoCast(me, SPELL_NEFARIANS_BARRIER);
me->SetStandState(UNIT_STAND_STATE_STAND);
@@ -342,7 +342,7 @@ public:
CreatureID = Entry[urand(0, 4)];
if (Creature* dragon = me->SummonCreature(CreatureID, DrakeSpawnLoc[i]))
{
- dragon->SetFaction(103);
+ dragon->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
dragon->AI()->AttackStart(me->GetVictim());
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
index 184b64a9cde..e5b49dd8910 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
@@ -75,7 +75,7 @@ public:
{
Initialize();
creature->AddNpcFlag(UNIT_NPC_FLAG_GOSSIP);
- creature->SetFaction(35);
+ creature->SetFaction(FACTION_FRIENDLY);
creature->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
@@ -153,7 +153,7 @@ public:
events.ScheduleEvent(EVENT_SPEECH_4, 16000);
break;
case EVENT_SPEECH_4:
- me->SetFaction(103);
+ me->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
AttackStart(player);
break;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
index cd1aeef7b97..72eb8f43cb9 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
@@ -55,7 +55,6 @@ enum Spells
enum Extras
{
OPTION_ID_YOU_CHALLENGED_US = 0,
- FACTION_FRIENDLY = 35,
MENU_OPTION_YOU_CHALLENGED_US = 4108
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
index 4e245db8aad..3e73c1e162e 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
@@ -175,7 +175,7 @@ class boss_ragnaros : public CreatureScript
{
//Become unbanished again
me->SetReactState(REACT_AGGRESSIVE);
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetEmoteState(EMOTE_ONESHOT_NONE);
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
@@ -253,7 +253,7 @@ class boss_ragnaros : public CreatureScript
me->InterruptNonMeleeSpells(false);
//Root self
//DoCast(me, 23973);
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetEmoteState(EMOTE_STATE_SUBMERGED);
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index 28bdb8e9056..c3a65c24fab 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -1382,7 +1382,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
{
Talk(SAY_JULIANNE_AGGRO);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
- me->SetFaction(16);
+ me->SetFaction(FACTION_MONSTER_2);
AggroYellTimer = 0;
} else AggroYellTimer -= diff;
}
@@ -1410,7 +1410,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
ENSURE_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO;
DoZoneInCombat(pRomulo);
- pRomulo->SetFaction(16);
+ pRomulo->SetFaction(FACTION_MONSTER_2);
}
SummonedRomulo = true;
} else SummonRomuloTimer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 9fa6e43ae5d..1a379d8676e 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -217,7 +217,7 @@ public:
{
float x = KaelLocations[0][0];
float y = KaelLocations[0][1];
- me->SetPosition(x, y, LOCATION_Z, 0.0f);
+ me->UpdatePosition(x, y, LOCATION_Z, 0.0f);
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
@@ -454,7 +454,7 @@ public:
Initialize();
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
DoCast(me, SPELL_FLAMESTRIKE2, true);
}
@@ -659,7 +659,7 @@ public:
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetDisableGravity(true);
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true);
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index d7e50807867..9134885bd46 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -129,7 +129,7 @@ public:
{
Initialize();
events.Reset();
- me->SetFaction(7);
+ me->SetFaction(FACTION_CREATURE);
me->AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->LoadEquipment(0, true);
@@ -235,7 +235,7 @@ public:
wait_timer -= diff;
else
{
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
phase = PHASE_ATTACKING;
@@ -484,8 +484,7 @@ enum Says_VBM
enum Misc_VBN
{
- QUEST_DEATH_CHALLENGE = 12733,
- FACTION_HOSTILE = 2068
+ QUEST_DEATH_CHALLENGE = 12733
};
class npc_death_knight_initiate : public CreatureScript
@@ -563,7 +562,7 @@ public:
{
if (m_uiDuelTimer <= uiDiff)
{
- me->SetFaction(FACTION_HOSTILE);
+ me->SetFaction(FACTION_UNDEAD_SCOURGE_2);
if (Unit* unit = ObjectAccessor::GetUnit(*me, m_uiDuelerGUID))
AttackStart(unit);
@@ -789,7 +788,7 @@ public:
{
charmer->RemoveAurasDueToSpell(SPELL_EFFECT_STOLEN_HORSE);
caster->RemoveNpcFlag(UNIT_NPC_FLAG_SPELLCLICK);
- caster->SetFaction(35);
+ caster->SetFaction(FACTION_FRIENDLY);
DoCast(caster, SPELL_CALL_DARK_RIDER, true);
if (Creature* Dark_Rider = me->FindNearestCreature(NPC_DARK_RIDER_OF_ACHERUS, 15))
ENSURE_AI(npc_dark_rider_of_acherus::npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster);
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 255e709ae90..461d326dd3e 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -621,7 +621,7 @@ public:
{
Unit* temp = me->SummonCreature(NPC_ACHERUS_GHOUL, (me->GetPositionX() - 20) + rand32() % 40, (me->GetPositionY() - 20) + rand32() % 40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
temp->SetWalk(false);
- temp->SetFaction(2084);
+ temp->SetFaction(FACTION_UNDEAD_SCOURGE_3);
uiGhoulGUID[uiSummon_counter] = temp->GetGUID();
++uiSummon_counter;
}
@@ -639,7 +639,7 @@ public:
{
Unit* temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, (me->GetPositionX() - 20) + rand32() % 40, (me->GetPositionY() - 20) + rand32() % 40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
temp->SetWalk(false);
- temp->SetFaction(2084);
+ temp->SetFaction(FACTION_UNDEAD_SCOURGE_3);
uiAbominationGUID[uiSummon_counter] = temp->GetGUID();
++uiSummon_counter;
}
@@ -657,7 +657,7 @@ public:
{
Unit* temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, (me->GetPositionX() - 20) + rand32() % 40, (me->GetPositionY() - 20) + rand32() % 40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
temp->SetWalk(false);
- temp->SetFaction(2084);
+ temp->SetFaction(FACTION_UNDEAD_SCOURGE_3);
uiWarriorGUID[uiSummon_counter] = temp->GetGUID();
++uiSummon_counter;
}
@@ -675,7 +675,7 @@ public:
{
Unit* temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, (me->GetPositionX() - 20) + rand32() % 40, (me->GetPositionY() - 20) + rand32() % 40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
temp->SetWalk(false);
- temp->SetFaction(2084);
+ temp->SetFaction(FACTION_UNDEAD_SCOURGE_3);
uiBehemothGUID[uiSummon_counter] = temp->GetGUID();
++uiSummon_counter;
}
@@ -1507,7 +1507,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
- temp->SetFaction(2084);
+ temp->SetFaction(FACTION_UNDEAD_SCOURGE_3);
uiGhoulGUID[i] = temp->GetGUID();
}
}
@@ -1517,7 +1517,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
- temp->SetFaction(2084);
+ temp->SetFaction(FACTION_UNDEAD_SCOURGE_3);
uiAbominationGUID[i] = temp->GetGUID();
}
}
@@ -1527,7 +1527,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
- temp->SetFaction(2084);
+ temp->SetFaction(FACTION_UNDEAD_SCOURGE_3);
uiWarriorGUID[i] = temp->GetGUID();
}
}
@@ -1537,7 +1537,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
- temp->SetFaction(2084);
+ temp->SetFaction(FACTION_UNDEAD_SCOURGE_3);
uiBehemothGUID[i] = temp->GetGUID();
}
}
@@ -1549,7 +1549,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
- temp->SetFaction(2089);
+ temp->SetFaction(FACTION_SCARLET_CRUSADE);
me->AddThreat(temp, 0.0f);
uiDefenderGUID[i] = temp->GetGUID();
}
@@ -1560,7 +1560,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
- temp->SetFaction(2089);
+ temp->SetFaction(FACTION_SCARLET_CRUSADE);
me->AddThreat(temp, 0.0f);
uiEarthshatterGUID[i] = temp->GetGUID();
}
@@ -1569,7 +1569,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
- temp->SetFaction(2089);
+ temp->SetFaction(FACTION_SCARLET_CRUSADE);
me->AddThreat(temp, 0.0f);
uiKorfaxGUID = temp->GetGUID();
}
@@ -1577,7 +1577,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
- temp->SetFaction(2089);
+ temp->SetFaction(FACTION_SCARLET_CRUSADE);
me->AddThreat(temp, 0.0f);
uiMaxwellGUID = temp->GetGUID();
}
@@ -1585,7 +1585,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
- temp->SetFaction(2089);
+ temp->SetFaction(FACTION_SCARLET_CRUSADE);
me->AddThreat(temp, 0.0f);
uiEligorGUID = temp->GetGUID();
}
@@ -1593,7 +1593,7 @@ public:
if (!temp)
{
temp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
- temp->SetFaction(2089);
+ temp->SetFaction(FACTION_SCARLET_CRUSADE);
me->AddThreat(temp, 0.0f);
uiRayneGUID = temp->GetGUID();
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
index fea8c330b9c..e97f8a8454d 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
@@ -78,7 +78,7 @@ public:
x -= 3.5f;
y -= 5.0f;
me->GetMotionMaster()->Clear(false);
- me->SetPosition(x, y, z, 0.0f);
+ me->UpdatePosition(x, y, z, 0.0f);
}
void UpdateAI(uint32 diff) override
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index d27c334a0de..75ff54ac3eb 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -805,7 +805,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z); //this visual aura some under ground
- me->SetPosition(x, y, z + 0.35f, 0.0f);
+ me->UpdatePosition(x, y, z + 0.35f, 0.0f);
debuffGUID.Clear();
Despawn();
Creature* debuff = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 14500);
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp
index a1714085160..1cfbabb638d 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp
@@ -56,6 +56,7 @@ enum ApothecarySays
SAY_CALL_BAXTER = 3,
SAY_CALL_FRYE = 4,
SAY_HUMMEL_DEATH = 5,
+ SAY_SUMMON_ADDS = 6,
SAY_BAXTER_DEATH = 0,
SAY_FRYE_DEATH = 0
};
@@ -77,8 +78,6 @@ enum ApothecaryMisc
{
ACTION_START_EVENT = 1,
ACTION_START_FIGHT = 2,
- FACTION_APOTHECARY_HOSTILE = 14,
- FACTION_APOTHECARY_FRIENDLY = 35,
GOSSIP_OPTION_START = 0,
GOSSIP_MENU_HUMMEL = 10847,
QUEST_YOUVE_BEEN_SERVED = 14488,
@@ -119,7 +118,7 @@ class boss_apothecary_hummel : public CreatureScript
_deadCount = 0;
_isDead = false;
events.SetPhase(PHASE_ALL);
- me->SetFaction(FACTION_APOTHECARY_FRIENDLY);
+ me->SetFaction(FACTION_FRIENDLY);
me->SummonCreatureGroup(1);
}
@@ -138,7 +137,7 @@ class boss_apothecary_hummel : public CreatureScript
events.ScheduleEvent(EVENT_HUMMEL_SAY_0, Milliseconds(1));
me->AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
- me->SetFaction(FACTION_APOTHECARY_HOSTILE);
+ me->SetFaction(FACTION_MONSTER);
DummyEntryCheckPredicate pred;
summons.DoAction(ACTION_START_EVENT, pred);
}
@@ -226,6 +225,7 @@ class boss_apothecary_hummel : public CreatureScript
events.ScheduleEvent(EVENT_PERFUME_SPRAY, Milliseconds(3640));
events.ScheduleEvent(EVENT_CHAIN_REACTION, Seconds(15));
+ Talk(SAY_SUMMON_ADDS);
std::vector<Creature*> trashs;
me->GetCreatureListWithEntryInGrid(trashs, NPC_CROWN_APOTHECARY);
for (Creature* crea : trashs)
@@ -294,7 +294,7 @@ struct npc_apothecary_genericAI : public ScriptedAI
if (action == ACTION_START_EVENT)
{
me->AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
- me->SetFaction(FACTION_APOTHECARY_HOSTILE);
+ me->SetFaction(FACTION_MONSTER);
me->GetMotionMaster()->MovePoint(1, _movePos);
}
else if (action == ACTION_START_FIGHT)
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index e7ee54390ed..0a0f528ffdd 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -161,7 +161,7 @@ public:
if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID))
Sath->AI()->EnterEvadeMode();
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
if (!bJustReset) //first reset at create
{
me->RemoveUnitFlag(UnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE));
@@ -388,7 +388,7 @@ public:
switch (TalkSequence)
{
case 1:
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
TalkTimer = 1000;
break;
case 2:
@@ -676,7 +676,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_SATH_DEATH);
- me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation());
+ me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation());
TeleportAllPlayersBack();
if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID))
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 0eff7cda638..146ebefceaf 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -294,7 +294,7 @@ public:
me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES);
for (uint8 i = 0; i < 4; ++i)
if (GameObject* pOrb = GetOrb(i))
- pOrb->SetFaction(0);
+ pOrb->SetFaction(FACTION_NONE);
}
void EmpowerOrb(bool all)
@@ -311,7 +311,7 @@ public:
if (GameObject* pOrb = GetOrb(i))
{
pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES);
- pOrb->SetFaction(35);
+ pOrb->SetFaction(FACTION_FRIENDLY);
pOrb->setActive(true);
pOrb->Refresh();
}
@@ -323,7 +323,7 @@ public:
if (GameObject* pOrb = GetOrb(urand(0, 3)))
{
pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES);
- pOrb->SetFaction(35);
+ pOrb->SetFaction(FACTION_FRIENDLY);
pOrb->setActive(true);
pOrb->Refresh();
@@ -381,7 +381,7 @@ class go_orb_of_the_blue_flight : public GameObjectScript
{
player->SummonCreature(NPC_POWER_OF_THE_BLUE_DRAGONFLIGHT, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000);
player->CastSpell(player, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false);
- me->SetFaction(0);
+ me->SetFaction(FACTION_NONE);
if (Creature* pKalec = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_KALECGOS_KJ)))
ENSURE_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames();
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index 1b301d553dc..6d2e392e18d 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -100,7 +100,7 @@ class boss_archaedas : public CreatureScript
Initialize();
instance->SetData(0, 5); // respawn any dead minions
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetControlled(true, UNIT_STATE_ROOT);
me->AddAura(SPELL_FREEZE_ANIM, me);
@@ -116,14 +116,14 @@ class boss_archaedas : public CreatureScript
minion->CastSpell(minion, SPELL_ARCHAEDAS_AWAKEN, true);
minion->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
minion->SetControlled(false, UNIT_STATE_ROOT);
- minion->SetFaction(14);
+ minion->SetFaction(FACTION_MONSTER);
minion->RemoveAura(SPELL_MINION_FREEZE_ANIM);
}
}
void EnterCombat(Unit* /*who*/) override
{
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetControlled(false, UNIT_STATE_ROOT);
}
@@ -272,7 +272,7 @@ class npc_archaedas_minions : public CreatureScript
void EnterCombat(Unit* /*who*/) override
{
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
me->RemoveAllAuras();
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetControlled(false, UNIT_STATE_ROOT);
@@ -352,7 +352,7 @@ class npc_stonekeepers : public CreatureScript
void Reset() override
{
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetControlled(true, UNIT_STATE_ROOT);
me->RemoveAllAuras();
@@ -361,7 +361,7 @@ class npc_stonekeepers : public CreatureScript
void EnterCombat(Unit* /*who*/) override
{
- me->SetFaction(14);
+ me->SetFaction(FACTION_FRIENDLY);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetControlled(false, UNIT_STATE_ROOT);
}
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
index ac3d2aa110f..0b6128af171 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -149,7 +149,7 @@ class instance_uldaman : public InstanceMapScript
void SetFrozenState(Creature* creature)
{
- creature->SetFaction(35);
+ creature->SetFaction(FACTION_FRIENDLY);
creature->RemoveAllAuras();
creature->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
creature->SetControlled(true, UNIT_STATE_ROOT);
@@ -184,7 +184,7 @@ class instance_uldaman : public InstanceMapScript
if (!target || !target->IsAlive())
continue;
target->SetControlled(false, UNIT_STATE_ROOT);
- target->SetFaction(14);
+ target->SetFaction(FACTION_MONSTER);
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
target->RemoveAura(SPELL_MINION_FREEZE_ANIM);
@@ -205,11 +205,11 @@ class instance_uldaman : public InstanceMapScript
for (GuidVector::const_iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
{
Creature* target = instance->GetCreature(*i);
- if (!target || !target->IsAlive() || target->GetFaction() == 14)
+ if (!target || !target->IsAlive() || target->GetFaction() == FACTION_MONSTER)
continue;
target->SetControlled(false, UNIT_STATE_ROOT);
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
- target->SetFaction(14);
+ target->SetFaction(FACTION_MONSTER);
target->RemoveAura(SPELL_MINION_FREEZE_ANIM);
archaedas->CastSpell(target, SPELL_AWAKEN_VAULT_WALKER, true);
target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN, true);
@@ -269,7 +269,7 @@ class instance_uldaman : public InstanceMapScript
if (!ironaya)
return;
- ironaya->SetFaction(415);
+ ironaya->SetFaction(FACTION_TITAN);
ironaya->SetControlled(false, UNIT_STATE_ROOT);
ironaya->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index 3ad749d537d..f9cd1192777 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -93,7 +93,6 @@ enum Misc
DATA_OHGANOT_SO_FAST = 5762,
- FACTION_NONE = 1665
};
enum SummonGroups
diff --git a/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
index f9f0985b416..0225040f053 100644
--- a/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
@@ -56,8 +56,7 @@ enum ProfessorPhizzlethorpe
QUEST_SUNKEN_TREASURE = 665,
QUEST_GOGGLE_BOGGLE = 26050,
// Creatures
- NPC_VENGEFUL_SURGE = 2776,
- FACTION_SUNKEN_TREASURE = 113
+ NPC_VENGEFUL_SURGE = 2776
};
class npc_professor_phizzlethorpe : public CreatureScript
@@ -113,7 +112,7 @@ class npc_professor_phizzlethorpe : public CreatureScript
{
Talk(SAY_PROGRESS_1, player);
npc_escortAI::Start(false, false, player->GetGUID(), quest);
- me->SetFaction(FACTION_SUNKEN_TREASURE);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
}
}
diff --git a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
index fd4617bb183..b00f3a0ee9d 100644
--- a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
@@ -52,8 +52,7 @@ enum RangerLilatha
GO_CAGE = 181152,
NPC_CAPTAIN_HELIOS = 16220,
NPC_MUMMIFIED_HEADHUNTER = 16342,
- NPC_SHADOWPINE_ORACLE = 16343,
- FACTION_QUEST_ESCAPE = 113
+ NPC_SHADOWPINE_ORACLE = 16343
};
class npc_ranger_lilatha : public CreatureScript
@@ -132,7 +131,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS)
{
- me->SetFaction(FACTION_QUEST_ESCAPE);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
Start(true, false, player->GetGUID());
}
}
diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
index 3fd9345ef0e..96f5b757c88 100644
--- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
@@ -45,9 +45,7 @@ enum eOOX
SAY_OOX_END = 4,
QUEST_RESQUE_OOX_09 = 836,
NPC_MARAUDING_OWL = 7808,
- NPC_VILE_AMBUSHER = 7809,
- FACTION_ESCORTEE_A = 774,
- FACTION_ESCORTEE_H = 775
+ NPC_VILE_AMBUSHER = 7809
};
class npc_oox09hl : public CreatureScript
@@ -79,7 +77,7 @@ public:
if (quest->GetQuestId() == QUEST_RESQUE_OOX_09)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
- me->SetFaction(player->GetTeam() == ALLIANCE ? FACTION_ESCORTEE_A : FACTION_ESCORTEE_H);
+ me->SetFaction(player->GetTeam() == ALLIANCE ? FACTION_ESCORTEE_A_PASSIVE : FACTION_ESCORTEE_H_PASSIVE);
Talk(SAY_OOX_START, player);
npc_escortAI::Start(false, false, player->GetGUID(), quest);
}
diff --git a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
index 16306014b1d..5015ff30cc2 100644
--- a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
@@ -39,8 +39,6 @@ enum Yenniku
{
SPELL_YENNIKUS_RELEASE = 3607,
QUEST_SAVING_YENNIKU = 592,
- FACTION_HORDE_GENERIC = 83,
- FACTION_TROLL_BLOODSCALP = 28
};
class npc_yenniku : public CreatureScript
diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
index 56cc8d49c25..f28570dc5d5 100644
--- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
@@ -150,7 +150,7 @@ public:
if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID))
{
target->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, me->GetOrientation(), 0);
- target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
+ target->UpdatePosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
}
@@ -298,7 +298,7 @@ public:
{
me->SetDisableGravity(true);
me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetDistance(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW) / (5000 * 0.001f));
- me->SetPosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation());
+ me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation());
EventMove = false;
} else EventMoveTimer -= diff;
}
diff --git a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
index 856080be6fa..f192a4bcf8f 100644
--- a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
@@ -39,7 +39,6 @@ EndContentData */
enum TapokeSlim
{
QUEST_MISSING_DIPLO_PT11 = 1249,
- FACTION_ENEMY = 168,
SPELL_STEALTH = 1785,
SPELL_CALL_FRIENDS = 16457, //summons 1x friend
NPC_SLIMS_FRIEND = 4971,
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index 823ddd33aa9..39a1cbd7dde 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -917,7 +917,7 @@ void hyjalAI::HideNearPos(float x, float y)
for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
{
(*itr)->SetVisible(false);
- (*itr)->SetFaction(35);//make them friendly so mobs won't attack them
+ (*itr)->SetFaction(FACTION_FRIENDLY);//make them friendly so mobs won't attack them
}
}
}
@@ -995,7 +995,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
if ((*itr) && (*itr)->IsAlive())
{
(*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
- (*itr)->SetFaction(35);//make them friendly so mobs won't attack them
+ (*itr)->SetFaction(FACTION_FRIENDLY);//make them friendly so mobs won't attack them
(*itr)->AddUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index 00ff25951df..4e280a1ca18 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -1175,7 +1175,7 @@ public:
me->GetPosition(x, y, z);
me->UpdateGroundPositionZ(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
- me->SetPosition(x, y, z, 0);
+ me->UpdatePosition(x, y, z, 0);
}
void EnterCombat(Unit* /*who*/) override { }
@@ -1293,7 +1293,7 @@ public:
me->GetPosition(x, y, z);
me->UpdateGroundPositionZ(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
- me->SetPosition(x, y, z, 0);
+ me->UpdatePosition(x, y, z, 0);
hyjal_trashAI::JustDied(killer);
}
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
index cb715b6f1e2..298a3535107 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
@@ -82,7 +82,7 @@ public:
if (Invisible && InvisibleTimer <= diff)
{
//Become visible again
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
//Noxxion model
me->SetDisplayId(11172);
@@ -122,7 +122,7 @@ public:
//Interrupt any spell casting
//me->m_canMove = true;
me->InterruptNonMeleeSpells(false);
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
// Invisible Model
me->SetDisplayId(11686);
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
index 2c1059a9bd9..6d1f4c70be9 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
@@ -58,8 +58,6 @@ enum Belnistrasz
EVENT_FIREBALL = 5,
EVENT_FROST_NOVA = 6,
- FACTION_ESCORT = 250,
-
PATH_ESCORT = 871710,
POINT_REACH_IDOL = 17,
@@ -137,7 +135,7 @@ public:
eventInProgress = true;
Talk(SAY_QUEST_ACCEPTED);
me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
- me->SetFaction(FACTION_ESCORT);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
me->GetMotionMaster()->MovePath(PATH_ESCORT, false);
}
}
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
index 19c999033d7..470908d9a5d 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
@@ -57,7 +57,7 @@ public:
switch (go->GetEntry())
{
case 21099: DoorWardGUID = go->GetGUID(); break;
- case 20920: go->SetFaction(0); break; // big fat fugly hack
+ case 20920: go->SetFaction(FACTION_NONE); break; // big fat fugly hack
}
}
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index 3f1ed9792ff..68d11185f33 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -58,7 +58,7 @@ public:
{
Start(true, false, player->GetGUID());
Talk(SAY_READY, player);
- me->SetFaction(113);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
}
}
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index 340ae314f92..59d33f235f4 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -1042,7 +1042,7 @@ public:
if (!target->HasAura(SPELL_DIGESTIVE_ACID))
{
- me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
+ me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
@@ -1159,7 +1159,7 @@ public:
if (!target->HasAura(SPELL_DIGESTIVE_ACID))
{
- me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
+ me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
index 3495a1a6d2b..067f326e011 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
@@ -111,7 +111,7 @@ public:
//Cast
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
DoCast(me, SPELL_DIRTMOUND_PASSIVE);
Submerged = true;
@@ -134,7 +134,7 @@ public:
if (Submerged && Back_Timer <= diff)
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
DoCastVictim(SPELL_GROUND_RUPTURE);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index 4dd49bb1c66..b27a339ed7b 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -227,8 +227,8 @@ struct boss_twinemperorsAI : public ScriptedAI
thisPos.Relocate(me);
Position otherPos;
otherPos.Relocate(pOtherBoss);
- pOtherBoss->SetPosition(thisPos);
- me->SetPosition(otherPos);
+ pOtherBoss->UpdatePosition(thisPos);
+ me->UpdatePosition(otherPos);
SetAfterTeleport();
ENSURE_AI(boss_twinemperorsAI, pOtherBoss->AI())->SetAfterTeleport();
@@ -332,7 +332,7 @@ struct boss_twinemperorsAI : public ScriptedAI
if (c->isDead())
{
c->Respawn();
- c->SetFaction(7);
+ c->SetFaction(FACTION_CREATURE);
c->RemoveAllAuras();
}
if (c->IsWithinDistInMap(me, ABUSE_BUG_RANGE))
@@ -427,7 +427,7 @@ public:
void CastSpellOnBug(Creature* target) override
{
- target->SetFaction(14);
+ target->SetFaction(FACTION_MONSTER);
target->AI()->AttackStart(me->getThreatManager().getHostilTarget());
target->AddAura(SPELL_MUTATE_BUG, target);
target->SetFullHealth();
@@ -518,7 +518,7 @@ public:
void CastSpellOnBug(Creature* target) override
{
- target->SetFaction(14);
+ target->SetFaction(FACTION_MONSTER);
target->AddAura(SPELL_EXPLODEBUG, target);
target->SetFullHealth();
}
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
index e3019c885bd..2c99ade96d3 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
@@ -329,7 +329,7 @@ public:
Talk(SAY_MAKE_PREPARATIONS);
- me->SetFaction(250);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
Start(false, false, player->GetGUID());
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp b/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp
index f8b39df3d93..03443d77c6f 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp
@@ -48,11 +48,6 @@ enum Events
EVENT_HEALING_WAVE = 4
};
-enum Faction
-{
- ZUMRAH_FRIENDLY_FACTION = 35
-};
-
class boss_zum_rah : public CreatureScript
{
public:
@@ -74,7 +69,7 @@ public:
void Reset() override
{
- me->SetFaction(ZUMRAH_FRIENDLY_FACTION); // areatrigger sets faction to enemy
+ me->SetFaction(FACTION_FRIENDLY); // areatrigger sets faction to enemy
Initialize();
}
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
index 6b74f7d0221..3589c70fbec 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
@@ -43,13 +43,6 @@ EndContentData */
## npc_sergeant_bly
######*/
-enum blyAndCrewFactions
-{
- FACTION_HOSTILE = 14,
- FACTION_FRIENDLY = 35, //while in cages (so the trolls won't attack them while they're caged)
- FACTION_FREED = 250 //after release (so they'll be hostile towards trolls)
-};
-
enum blySays
{
SAY_1 = 0,
@@ -120,7 +113,7 @@ public:
Text_Timer = 5000;
break;
case 3:
- me->SetFaction(FACTION_HOSTILE);
+ me->SetFaction(FACTION_MONSTER);
if (Player* target = ObjectAccessor::GetPlayer(*me, PlayerGUID))
AttackStart(target);
@@ -165,7 +158,7 @@ public:
{
if (Creature* crew = ObjectAccessor::GetCreature(*me, instance->GetGuidData(entry)))
if (crew->IsAlive())
- crew->SetFaction(FACTION_HOSTILE);
+ crew->SetFaction(FACTION_MONSTER);
}
bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
@@ -239,7 +232,7 @@ public:
crew->SetWalk(true);
crew->SetHomePosition(x, y, z, 0);
crew->GetMotionMaster()->MovePoint(1, x, y, z);
- crew->SetFaction(FACTION_FREED);
+ crew->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
}
}
};
diff --git a/src/server/scripts/Kalimdor/zone_ashenvale.cpp b/src/server/scripts/Kalimdor/zone_ashenvale.cpp
index 854e5322667..5fcf56a797e 100644
--- a/src/server/scripts/Kalimdor/zone_ashenvale.cpp
+++ b/src/server/scripts/Kalimdor/zone_ashenvale.cpp
@@ -44,7 +44,6 @@ enum RuulSnowhoof
NPC_THISTLEFUR_TOTEMIC = 3922,
NPC_THISTLEFUR_PATHFINDER = 3926,
QUEST_FREEDOM_TO_RUUL = 6482,
- FACTION_QUEST = 113,
GO_CAGE = 178147
};
@@ -84,7 +83,7 @@ public:
{
if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
{
- me->SetFaction(FACTION_QUEST);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
npc_escortAI::Start(true, false, player->GetGUID());
}
}
@@ -227,7 +226,7 @@ public:
if (quest->GetQuestId() == QUEST_VORSHA)
{
Talk(SAY_MUG_START1);
- me->SetFaction(FACTION_QUEST);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
npc_escortAI::Start(true, false, player->GetGUID());
}
}
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index b834317359b..4bef27b450a 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -188,7 +188,6 @@ enum Overgrind
AREA_COVE = 3579,
AREA_ISLE = 3639,
QUEST_GNOMERCY = 9537,
- FACTION_HOSTILE = 14,
SPELL_DYNAMITE = 7978
};
@@ -233,7 +232,7 @@ public:
bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
{
CloseGossipMenuFor(player);
- me->SetFaction(FACTION_HOSTILE);
+ me->SetFaction(FACTION_MONSTER);
me->Attack(player, true);
return false;
}
@@ -339,8 +338,7 @@ enum Magwin
EVENT_STAND = 3,
EVENT_TALK_END = 4,
EVENT_COWLEN_TALK = 5,
- QUEST_A_CRY_FOR_HELP = 9528,
- FACTION_QUEST = 113
+ QUEST_A_CRY_FOR_HELP = 9528
};
class npc_magwin : public CreatureScript
@@ -405,7 +403,7 @@ public:
case EVENT_ACCEPT_QUEST:
if (Player* player = ObjectAccessor::GetPlayer(*me, _player))
Talk(SAY_START, player);
- me->SetFaction(FACTION_QUEST);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
_events.ScheduleEvent(EVENT_START_ESCORT, Seconds(1));
break;
case EVENT_START_ESCORT:
diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
index 99cc3ce925c..88429574c30 100644
--- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
@@ -99,7 +99,6 @@ enum Hendel
EMOTE_SURRENDER = 4,
QUEST_MISSING_DIPLO_PT16 = 1324,
- FACTION_HOSTILE = 168, //guessed, may be different
NPC_SENTRY = 5184, //helps hendel
NPC_JAINA = 4968, //appears once hendel gives up
@@ -149,7 +148,7 @@ public:
void QuestAccept(Player* /*player*/, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_MISSING_DIPLO_PT16)
- me->SetFaction(FACTION_HOSTILE);
+ me->SetFaction(FACTION_ENEMY);
}
};
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index bf1dc96d5e4..661eef0ad1f 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -54,9 +54,6 @@ enum EternalBoard
{
QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519,
- FACTION_HOSTILE = 14,
- FACTION_FRIENDLY = 35,
-
EVENT_AREA_RADIUS = 65, // 65yds
EVENT_COOLDOWN = 500000, // in ms. appears after event completed or failed (should be = Adds despawn time)
@@ -985,7 +982,7 @@ public:
Merithra->SetNpcFlags(UNIT_NPC_FLAG_NONE);
Merithra->SetStandState(UNIT_STAND_STATE_STAND);
Merithra->SetDisplayId(MERITHRA_NIGHT_ELF_FORM);
- Merithra->SetFaction(35);
+ Merithra->SetFaction(FACTION_FRIENDLY);
}
if (Caelestrasz)
@@ -993,7 +990,7 @@ public:
Caelestrasz->SetNpcFlags(UNIT_NPC_FLAG_NONE);
Caelestrasz->SetStandState(UNIT_STAND_STATE_STAND);
Caelestrasz->SetDisplayId(CAELESTRASZ_NIGHT_ELF_FORM);
- Caelestrasz->SetFaction(35);
+ Caelestrasz->SetFaction(FACTION_FRIENDLY);
}
if (Arygos)
@@ -1001,7 +998,7 @@ public:
Arygos->SetNpcFlags(UNIT_NPC_FLAG_NONE);
Arygos->SetStandState(UNIT_STAND_STATE_STAND);
Arygos->SetDisplayId(ARYGOS_GNOME_FORM);
- Arygos->SetFaction(35);
+ Arygos->SetFaction(FACTION_FRIENDLY);
}
if (Anachronos)
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index 78d64e4d21a..6a070468b38 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -90,7 +90,7 @@ public:
void Reset() override
{
Initialize();
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
}
void SendItem(Unit* receiver)
@@ -120,7 +120,7 @@ public:
{
if (SwitchFactionTimer <= diff)
{
- me->SetFaction(91);
+ me->SetFaction(FACTION_ELEMENTAL);
isFriendly = false;
} else SwitchFactionTimer -= diff;
}
@@ -362,7 +362,7 @@ public:
{
if (quest->GetQuestId() == Q_OOX17)
{
- me->SetFaction(113);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
me->SetFullHealth();
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index fd602f78a6d..734f14e65f4 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -87,8 +87,7 @@ enum Gilthares
SAY_GIL_FREED = 7,
QUEST_FREE_FROM_HOLD = 898,
- AREA_MERCHANT_COAST = 391,
- FACTION_ESCORTEE = 232 //guessed, possible not needed for this quest
+ AREA_MERCHANT_COAST = 391
};
class npc_gilthares : public CreatureScript
@@ -150,7 +149,7 @@ public:
{
if (quest->GetQuestId() == QUEST_FREE_FROM_HOLD)
{
- me->SetFaction(FACTION_ESCORTEE);
+ me->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_ACTIVE);
me->SetStandState(UNIT_STAND_STATE_STAND);
Talk(SAY_GIL_START, player);
diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp
index d29175c8985..81b79d276cb 100644
--- a/src/server/scripts/Kalimdor/zone_winterspring.cpp
+++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp
@@ -587,7 +587,7 @@ public:
if (quest->GetQuestId() == QUEST_GUARDIANS_ALTAR)
{
Talk(SAY_QUEST_START);
- me->SetFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE);
+ me->SetFaction(FACTION_ESCORTEE_A_NEUTRAL_PASSIVE);
Start(false, false, player->GetGUID(), quest);
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
index 81dcf1846a6..895b9e15cc4 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -195,7 +195,7 @@ public:
{
damage = 0;
EnterEvadeMode();
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
bDone = true;
}
}
@@ -323,7 +323,7 @@ public:
{
damage = 0;
EnterEvadeMode();
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
bDone = true;
}
}
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 868bb4e07c8..34af2872fdd 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -226,7 +226,7 @@ class boss_anubarak_trial : public CreatureScript
for (int i = 0; i < 10; i++)
if (Creature* scarab = me->SummonCreature(NPC_SCARAB, AnubarakLoc[1].GetPositionX()+urand(0, 50)-25, AnubarakLoc[1].GetPositionY()+urand(0, 50)-25, AnubarakLoc[1].GetPositionZ()))
{
- scarab->SetFaction(31);
+ scarab->SetFaction(FACTION_PREY);
scarab->GetMotionMaster()->MoveRandom(10);
}
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index d4976c75255..cdf2feee3e8 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -204,7 +204,6 @@ enum Actions
enum Misc
{
DATA_MADE_A_MESS = 45374613, // 4537, 4613 are achievement IDs
- FACTION_SCOURGE = 974,
GOSSIP_MENU_MURADIN_BRONZEBEARD = 10934,
GOSSIP_MENU_HIGH_OVERLORD_SAURFANG = 10952
@@ -463,7 +462,7 @@ class boss_deathbringer_saurfang : public CreatureScript
{
case EVENT_INTRO_ALLIANCE_2:
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
- me->SetFaction(FACTION_SCOURGE);
+ me->SetFaction(FACTION_UNDEAD_SCOURGE);
Talk(SAY_INTRO_ALLIANCE_2);
break;
case EVENT_INTRO_ALLIANCE_3:
@@ -476,7 +475,7 @@ class boss_deathbringer_saurfang : public CreatureScript
break;
case EVENT_INTRO_HORDE_2:
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
- me->SetFaction(FACTION_SCOURGE);
+ me->SetFaction(FACTION_UNDEAD_SCOURGE);
Talk(SAY_INTRO_HORDE_2);
break;
case EVENT_INTRO_HORDE_4:
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index f4e8d4e10b1..638c600905f 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -57,62 +57,68 @@ enum ScriptTexts
enum Spells
{
// Lady Deathwhisper
- SPELL_MANA_BARRIER = 70842,
- SPELL_SHADOW_BOLT = 71254,
- SPELL_DEATH_AND_DECAY = 71001,
- SPELL_DOMINATE_MIND = 71289,
- SPELL_DOMINATE_MIND_SCALE = 71290,
- SPELL_FROSTBOLT = 71420,
- SPELL_FROSTBOLT_VOLLEY = 72905,
- SPELL_TOUCH_OF_INSIGNIFICANCE = 71204,
- SPELL_SUMMON_SHADE = 71363,
- SPELL_SHADOW_CHANNELING = 43897,
- SPELL_DARK_TRANSFORMATION_T = 70895,
- SPELL_DARK_EMPOWERMENT_T = 70896,
- SPELL_DARK_MARTYRDOM_T = 70897,
- SPELL_SUMMON_SPIRITS = 72478,
+ SPELL_MANA_BARRIER = 70842,
+ SPELL_SHADOW_BOLT = 71254,
+ SPELL_DEATH_AND_DECAY = 71001,
+ SPELL_DOMINATE_MIND = 71289,
+ SPELL_DOMINATE_MIND_SCALE = 71290,
+ SPELL_FROSTBOLT = 71420,
+ SPELL_FROSTBOLT_VOLLEY = 72905,
+ SPELL_TOUCH_OF_INSIGNIFICANCE = 71204,
+ SPELL_SUMMON_SHADE = 71363,
+ SPELL_SHADOW_CHANNELING = 43897,
+ SPELL_DARK_TRANSFORMATION_T = 70895,
+ SPELL_DARK_EMPOWERMENT_T = 70896,
+ SPELL_DARK_MARTYRDOM_T = 70897,
+ SPELL_SUMMON_SPIRITS = 72478,
// Achievement
- SPELL_FULL_HOUSE = 72827, // does not exist in dbc but still can be used for criteria check
+ SPELL_FULL_HOUSE = 72827, // does not exist in dbc but still can be used for criteria check
// Both Adds
- SPELL_TELEPORT_VISUAL = 41236,
- SPELL_CLEAR_ALL_DEBUFFS = 34098,
- SPELL_FULL_HEAL = 17683,
- SPELL_PERMANENT_FEIGN_DEATH = 70628,
+ SPELL_TELEPORT_VISUAL = 41236,
+ SPELL_CLEAR_ALL_DEBUFFS = 34098,
+ SPELL_FULL_HEAL = 17683,
+ SPELL_PERMANENT_FEIGN_DEATH = 70628,
// Fanatics
- SPELL_DARK_TRANSFORMATION = 70900,
- SPELL_NECROTIC_STRIKE = 70659,
- SPELL_SHADOW_CLEAVE = 70670,
- SPELL_VAMPIRIC_MIGHT = 70674,
- SPELL_FANATIC_S_DETERMINATION = 71235,
- SPELL_DARK_MARTYRDOM_FANATIC = 71236,
+ SPELL_DARK_TRANSFORMATION = 70900,
+ SPELL_NECROTIC_STRIKE = 70659,
+ SPELL_SHADOW_CLEAVE = 70670,
+ SPELL_VAMPIRIC_MIGHT = 70674,
+ SPELL_FANATIC_S_DETERMINATION = 71235,
+ SPELL_DARK_MARTYRDOM_FANATIC = 71236,
+ SPELL_DARK_MARTYRDOM_FANATIC_25N = 72495,
+ SPELL_DARK_MARTYRDOM_FANATIC_10H = 72496,
+ SPELL_DARK_MARTYRDOM_FANATIC_25H = 72497,
// Adherents
- SPELL_DARK_EMPOWERMENT = 70901,
- SPELL_FROST_FEVER = 67767,
- SPELL_DEATHCHILL_BOLT = 70594,
- SPELL_DEATHCHILL_BLAST = 70906,
- SPELL_CURSE_OF_TORPOR = 71237,
- SPELL_SHROUD_OF_THE_OCCULT = 70768,
- SPELL_ADHERENT_S_DETERMINATION = 71234,
- SPELL_DARK_MARTYRDOM_ADHERENT = 70903,
+ SPELL_DARK_EMPOWERMENT = 70901,
+ SPELL_FROST_FEVER = 67767,
+ SPELL_DEATHCHILL_BOLT = 70594,
+ SPELL_DEATHCHILL_BLAST = 70906,
+ SPELL_CURSE_OF_TORPOR = 71237,
+ SPELL_SHROUD_OF_THE_OCCULT = 70768,
+ SPELL_ADHERENT_S_DETERMINATION = 71234,
+ SPELL_DARK_MARTYRDOM_ADHERENT = 70903,
+ SPELL_DARK_MARTYRDOM_ADHERENT_25N = 72498,
+ SPELL_DARK_MARTYRDOM_ADHERENT_10H = 72499,
+ SPELL_DARK_MARTYRDOM_ADHERENT_25H = 72500,
// Vengeful Shade
- SPELL_VENGEFUL_BLAST = 71544,
- SPELL_VENGEFUL_BLAST_PASSIVE = 71494,
- SPELL_VENGEFUL_BLAST_25N = 72010,
- SPELL_VENGEFUL_BLAST_10H = 72011,
- SPELL_VENGEFUL_BLAST_25H = 72012,
+ SPELL_VENGEFUL_BLAST = 71544,
+ SPELL_VENGEFUL_BLAST_PASSIVE = 71494,
+ SPELL_VENGEFUL_BLAST_25N = 72010,
+ SPELL_VENGEFUL_BLAST_10H = 72011,
+ SPELL_VENGEFUL_BLAST_25H = 72012,
// Darnavan
- SPELL_BLADESTORM = 65947,
- SPELL_CHARGE = 65927,
- SPELL_INTIMIDATING_SHOUT = 65930,
- SPELL_MORTAL_STRIKE = 65926,
- SPELL_SHATTERING_THROW = 65940,
- SPELL_SUNDER_ARMOR = 65936,
+ SPELL_BLADESTORM = 65947,
+ SPELL_CHARGE = 65927,
+ SPELL_INTIMIDATING_SHOUT = 65930,
+ SPELL_MORTAL_STRIKE = 65926,
+ SPELL_SHATTERING_THROW = 65940,
+ SPELL_SUNDER_ARMOR = 65936,
};
enum EventTypes
@@ -359,7 +365,7 @@ class boss_lady_deathwhisper : public CreatureScript
{
if (darnavan->IsAlive())
{
- darnavan->SetFaction(35);
+ darnavan->SetFaction(FACTION_FRIENDLY);
darnavan->CombatStop(true);
darnavan->GetMotionMaster()->MoveIdle();
darnavan->SetReactState(REACT_PASSIVE);
@@ -640,6 +646,9 @@ class npc_cult_fanatic : public CreatureScript
DoCastSelf(SPELL_DARK_MARTYRDOM_FANATIC);
break;
case SPELL_DARK_MARTYRDOM_FANATIC:
+ case SPELL_DARK_MARTYRDOM_FANATIC_25N:
+ case SPELL_DARK_MARTYRDOM_FANATIC_10H:
+ case SPELL_DARK_MARTYRDOM_FANATIC_25H:
_scheduler
.Schedule(Seconds(2), [this](TaskContext /*context*/)
{
@@ -739,6 +748,9 @@ class npc_cult_adherent : public CreatureScript
DoCastSelf(SPELL_DARK_MARTYRDOM_ADHERENT);
break;
case SPELL_DARK_MARTYRDOM_ADHERENT:
+ case SPELL_DARK_MARTYRDOM_ADHERENT_25N:
+ case SPELL_DARK_MARTYRDOM_ADHERENT_10H:
+ case SPELL_DARK_MARTYRDOM_ADHERENT_25H:
_scheduler
.Schedule(Seconds(2), [this](TaskContext /*context*/)
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index 0a7857225ad..97ba864358a 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -264,7 +264,7 @@ class ValithriaDespawner : public BasicEvent
creature->SetRespawnDelay(10);
if (CreatureData const* data = creature->GetCreatureData())
- creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation);
+ creature->UpdatePosition(data->posX, data->posY, data->posZ, data->orientation);
creature->DespawnOrUnsummon();
creature->SetCorpseDelay(corpseDelay);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 1e857d6164c..1462ebc1df1 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -358,7 +358,7 @@ class FrostwingGauntletRespawner
creature->SetRespawnDelay(2);
if (CreatureData const* data = creature->GetCreatureData())
- creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation);
+ creature->UpdatePosition(data->posX, data->posY, data->posZ, data->orientation);
creature->DespawnOrUnsummon();
creature->SetCorpseDelay(corpseDelay);
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 0aa77ef0eb2..cb85a35c884 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -175,12 +175,6 @@ enum Seats
SEAT_0 = 0
};
-enum Factions
-{
- // Needed for melee hover disks /when Nexus Lords die/
- FACTION_FRIENDLY = 35
-};
-
enum Actions
{
// Malygos
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 a75650dd6ba..48b1772ea95 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
@@ -261,7 +261,7 @@ public:
for (uint8 n = 0; n < 3; ++n)
time[n] = 0;
me->GetMotionMaster()->Clear();
- me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
+ me->UpdatePosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
DoCast(me, SPELL_TELESTRA_BACK);
me->SetVisible(true);
if (Phase == 1)
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
index 857ce9c32b4..5b3228e6413 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
@@ -23,11 +23,6 @@
#include "nexus.h"
#include "Player.h"
-enum Factions
-{
- FACTION_HOSTILE_FOR_ALL = 16
-};
-
class instance_nexus : public InstanceMapScript
{
public:
@@ -61,31 +56,31 @@ class instance_nexus : public InstanceMapScript
// Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs.
case NPC_ALLIANCE_BERSERKER:
if (ServerAllowsTwoSideGroups())
- creature->SetFaction(FACTION_HOSTILE_FOR_ALL);
+ creature->SetFaction(FACTION_MONSTER_2);
if (_teamInInstance == ALLIANCE)
creature->UpdateEntry(NPC_HORDE_BERSERKER);
break;
case NPC_ALLIANCE_RANGER:
if (ServerAllowsTwoSideGroups())
- creature->SetFaction(FACTION_HOSTILE_FOR_ALL);
+ creature->SetFaction(FACTION_MONSTER_2);
if (_teamInInstance == ALLIANCE)
creature->UpdateEntry(NPC_HORDE_RANGER);
break;
case NPC_ALLIANCE_CLERIC:
if (ServerAllowsTwoSideGroups())
- creature->SetFaction(FACTION_HOSTILE_FOR_ALL);
+ creature->SetFaction(FACTION_MONSTER_2);
if (_teamInInstance == ALLIANCE)
creature->UpdateEntry(NPC_HORDE_CLERIC);
break;
case NPC_ALLIANCE_COMMANDER:
if (ServerAllowsTwoSideGroups())
- creature->SetFaction(FACTION_HOSTILE_FOR_ALL);
+ creature->SetFaction(FACTION_MONSTER_2);
if (_teamInInstance == ALLIANCE)
creature->UpdateEntry(NPC_HORDE_COMMANDER);
break;
case NPC_COMMANDER_STOUTBEARD:
if (ServerAllowsTwoSideGroups())
- creature->SetFaction(FACTION_HOSTILE_FOR_ALL);
+ creature->SetFaction(FACTION_MONSTER_2);
if (_teamInInstance == ALLIANCE)
creature->UpdateEntry(NPC_COMMANDER_KOLURG);
break;
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 3f622a72c83..201655985d1 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
@@ -538,7 +538,7 @@ class boss_algalon_the_observer : public CreatureScript
damage = 0;
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_SELF_STUN);
events.Reset();
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 09240de5649..004760c07ee 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -780,7 +780,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(me->GetPhaseShift(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
- me->SetPosition(x, y, z, 0);
+ me->UpdatePosition(x, y, z, 0);
}
void UpdateAI(uint32 /*diff*/) override
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index 33e346e0c94..e0a73d09571 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -226,7 +226,7 @@ class npc_iron_roots : public CreatureScript
SetCombatMovement(false);
me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); // Death Grip
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
me->SetReactState(REACT_PASSIVE);
}
@@ -270,6 +270,7 @@ class boss_freya : public CreatureScript
{
boss_freyaAI(Creature* creature) : BossAI(creature, BOSS_FREYA)
{
+ _encounterFinished = false;
Initialize();
memset(elementalTimer, 0, sizeof(elementalTimer));
diffTimer = 0;
@@ -312,9 +313,13 @@ class boss_freya : public CreatureScript
bool checkElementalAlive[2];
bool trioDefeated[2];
bool random[3];
+ bool _encounterFinished;
void Reset() override
{
+ if (_encounterFinished)
+ return;
+
_Reset();
Initialize();
}
@@ -595,6 +600,11 @@ class boss_freya : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
+ if (_encounterFinished)
+ return;
+
+ _encounterFinished = true;
+
//! Freya's chest is dynamically spawned on death by different spells.
const uint32 summonSpell[2][4] =
{
@@ -606,15 +616,15 @@ class boss_freya : public CreatureScript
me->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficultyID() - DIFFICULTY_10_N][elderCount], true);
Talk(SAY_DEATH);
+
me->SetReactState(REACT_PASSIVE);
- _JustDied();
- me->RemoveAllAuras();
+ me->InterruptNonMeleeSpells(true);
+ me->RemoveAllAttackers();
me->AttackStop();
- me->SetFaction(35);
- me->DeleteThreatList();
- me->CombatStop(true);
+ me->SetFaction(FACTION_FRIENDLY);
me->DespawnOrUnsummon(7500);
me->CastSpell(me, SPELL_KNOCK_ON_WOOD_CREDIT, true);
+ _JustDied();
for (uint8 n = 0; n < 3; ++n)
{
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index a320994dc07..6635ece7ee9 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
@@ -408,7 +408,7 @@ class boss_hodir : public CreatureScript
DoCastAOE(SPELL_KILL_CREDIT, true); /// need to be cast before changing boss faction
/// spell will target enemies only
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->DespawnOrUnsummon(10000);
_JustDied();
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
index cfe2d3879d1..76acc9e7c45 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
@@ -180,7 +180,7 @@ class boss_ignis : public CreatureScript
{
if (summon->GetEntry() == NPC_IRON_CONSTRUCT)
{
- summon->SetFaction(16);
+ summon->SetFaction(FACTION_MONSTER_2);
summon->SetReactState(REACT_AGGRESSIVE);
summon->RemoveUnitFlag(UnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED | UNIT_FLAG_IMMUNE_TO_PC));
summon->SetControlled(false, UNIT_STATE_ROOT);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
index 690a1ecdbfc..b23e296f0df 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
@@ -638,7 +638,7 @@ class boss_mimiron : public CreatureScript
case EVENT_OUTTRO_1:
me->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL_1);
DoCast(me, SPELL_SLEEP_VISUAL_2);
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
events.ScheduleEvent(EVENT_OUTTRO_2, 3000);
break;
case EVENT_OUTTRO_2:
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
index a833e13aeec..825718bd3ee 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
@@ -15,27 +15,427 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "MoveSplineInit.h"
+#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "TypeContainerVisitor.h"
+#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
#include "ulduar.h"
+#include "SpellAuras.h"
+#include "SpellMgr.h"
+#include <G3D/Vector3.h>
+#include "AreaBoundary.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "MotionMaster.h"
+
+enum Spells
+{
+ // Thorim
+ SPELL_SHEATH_OF_LIGHTNING = 62276,
+ SPELL_STORMHAMMER = 62042,
+ SPELL_STORMHAMMER_SIF = 64767,
+ SPELL_STORMHAMMER_BOOMERANG = 64909,
+ SPELL_DEAFENING_THUNDER = 62470,
+ SPELL_CHARGE_ORB = 62016,
+ SPELL_SUMMON_LIGHTNING_ORB = 62391,
+ SPELL_LIGHTNING_DESTRUCTION = 62393,
+ SPELL_TOUCH_OF_DOMINION = 62507,
+ SPELL_TOUCH_OF_DOMINION_TRIGGERED = 62565,
+ SPELL_CHAIN_LIGHTNING = 62131,
+ SPELL_LIGHTNING_ORB_CHARGED = 62186, // wrong duration, triggered spell should handle lightning release
+ SPELL_LIGHTNING_CHARGE = 62279,
+ SPELL_LIGHTNING_RELEASE = 62466,
+ SPELL_LIGHTNING_PILLAR_2 = 62976, // caster high position, target low position
+ SPELL_LIGHTNING_PILLAR_1 = 63238, // caster high position, target low position
+ SPELL_UNBALANCING_STRIKE = 62130,
+ SPELL_BERSERK_PHASE_1 = 62560,
+ SPELL_BERSERK_PHASE_2 = 62555,
+ SPELL_ACTIVATE_LIGHTNING_ORB_PERIODIC = 62184,
+
+ // Credits
+ SPELL_CREDIT_SIFFED = 64980,
+ SPELL_CREDIT_KILL = 64985,
+
+ // Lightning Field
+ SPELL_LIGHTNING_FIELD = 64972,
+ SPELL_LIGHTNING_BEAM_CHANNEL = 45537,
+
+ // Sif
+ SPELL_BLIZZARD = 62577,
+ SPELL_BLINK = 62578,
+ SPELL_FROSTBOLT_VOLLEY = 62580,
+ SPELL_FROSTBOLT = 62583,
+ SPELL_FROSTNOVA = 62597,
+ SPELL_SIF_TRANSFORM = 64778,
+
+ // Runic Colossus
+ SPELL_SMASH = 62339,
+ SPELL_RUNIC_BARRIER = 62338,
+ SPELL_RUNIC_CHARGE = 62613,
+ SPELL_RUNIC_SMASH = 62465,
+ SPELL_RUNIC_SMASH_RIGHT = 62057,
+ SPELL_RUNIC_SMASH_LEFT = 62058,
+
+ // Ancient Rune Giant
+ SPELL_RUNIC_FORTIFICATION = 62942,
+ SPELL_RUNE_DETONATION = 62526,
+ SPELL_STOMP = 62411
+};
+
+enum Phases
+{
+ PHASE_NULL,
+ PHASE_1,
+ PHASE_2
+};
+
+enum Events
+{
+ // Thorim
+ EVENT_SAY_AGGRO_2 = 1,
+ EVENT_SAY_SIF_START,
+ EVENT_START_SIF_CHANNEL,
+ EVENT_STORMHAMMER,
+ EVENT_CHARGE_ORB,
+ EVENT_SUMMON_ADDS,
+ EVENT_BERSERK,
+ EVENT_JUMPDOWN,
+ EVENT_UNBALANCING_STRIKE,
+ EVENT_CHAIN_LIGHTNING,
+ EVENT_START_PERIODIC_CHARGE,
+ EVENT_LIGHTNING_CHARGE,
+ EVENT_ACTIVATE_LIGHTNING_FIELD,
+ EVENT_OUTRO_1,
+ EVENT_OUTRO_2,
+ EVENT_OUTRO_3,
+
+ // Runic Colossus
+ EVENT_RUNIC_BARRIER,
+ EVENT_SMASH,
+ EVENT_RUNIC_CHARGE,
+ EVENT_RUNIC_SMASH,
+
+ // Ancient Rune Giant
+ EVENT_RUNIC_FORTIFICATION,
+ EVENT_STOMP,
+ EVENT_RUNE_DETONATION,
+
+ // Arena NPC
+ EVENT_PRIMARY_ABILITY,
+ EVENT_SECONDARY_ABILITY,
+ EVENT_THIRD_ABILITY,
+ EVENT_ABILITY_CHARGE,
+
+ // Sif
+ EVENT_BLINK,
+ EVENT_FROST_NOVA,
+ EVENT_FROSTBOLT,
+ EVENT_FROSTBOLT_VOLLEY,
+ EVENT_BLIZZARD
+};
enum Yells
{
- SAY_AGGRO = 0,
- SAY_SPECIAL_1 = 1,
- SAY_SPECIAL_2 = 2,
- SAY_SPECIAL_3 = 3,
- SAY_JUMPDOWN = 4,
- SAY_SLAY = 5,
- SAY_BERSERK = 6,
- SAY_WIPE = 7,
- SAY_DEATH = 8,
- SAY_END_NORMAL_1 = 9,
- SAY_END_NORMAL_2 = 10,
- SAY_END_NORMAL_3 = 11,
- SAY_END_HARD_1 = 12,
- SAY_END_HARD_2 = 13,
- SAY_END_HARD_3 = 14
+ // Thorim
+ SAY_AGGRO_1 = 0,
+ SAY_AGGRO_2 = 1,
+ SAY_SPECIAL = 2,
+ SAY_JUMPDOWN = 3,
+ SAY_SLAY = 4,
+ SAY_BERSERK = 5,
+ SAY_WIPE = 6,
+ SAY_DEATH = 7,
+ SAY_END_NORMAL_1 = 8,
+ SAY_END_NORMAL_2 = 9,
+ SAY_END_NORMAL_3 = 10,
+ SAY_END_HARD_1 = 11,
+ SAY_END_HARD_2 = 12,
+ SAY_END_HARD_3 = 13,
+
+ // Runic Colossus
+ EMOTE_RUNIC_BARRIER = 0,
+
+ // Ancient Rune Giant
+ EMOTE_RUNIC_MIGHT = 0,
+
+ // Sif
+ SAY_SIF_START = 0,
+ SAY_SIF_DESPAWN = 1,
+ SAY_SIF_EVENT = 2
+};
+
+enum PreAddSpells
+{
+ SPELL_ACID_BREATH = 62315,
+ SPELL_SWEEP = 62316,
+
+ SPELL_DEVASTATE = 62317,
+ SPELL_HEROIC_SWIPE = 62444,
+ SPELL_SUNDER_ARMOR = 57807,
+
+ SPELL_BARBED_SHOT = 62318,
+ SPELL_SHOOT = 16496,
+
+ SPELL_RENEW = 62333,
+ SPELL_GREATER_HEAL = 62334, /// 61965
+ SPELL_CIRCLE_OF_HEALING = 61964,
+
+ SPELL_HOLY_SMITE = 62335,
+
+ SPELL_LEAP = 61934,
+
+ SPELL_CHARGE = 32323,
+ SPELL_MORTAL_STRIKE = 35054,
+ SPELL_WHIRLWIND = 33500,
+
+ SPELL_LOW_BLOW = 62326,
+ SPELL_PUMMEL = 38313,
+
+ SPELL_RUNIC_LIGHTNING = 62327,
+ SPELL_RUNIC_MENDING = 62328,
+ SPELL_RUNIC_SHIELD = 62321,
+
+ SPELL_RUNIC_STRIKE = 62322,
+ SPELL_AURA_OF_CELERITY = 62320,
+
+ SPELL_IMPALE = 62331,
+ SPELL_WHIRLING_TRIP = 64151,
+
+ SPELL_CLEAVE = 42724,
+ SPELL_HAMSTRING = 48639,
+ SPELL_SHIELD_SMASH = 62332,
+};
+
+enum TrashTypes
+{
+ // Pre Phase Trash
+ BEHEMOTH,
+ MERCENARY_CAPTAIN,
+ MERCENARY_SOLDIER,
+
+ // Arena Phase Trash
+ DARK_RUNE_CHAMPION,
+ DARK_RUNE_WARBRINGER,
+ DARK_RUNE_COMMONER,
+ DARK_RUNE_EVOKER,
+
+ // Hall Way Trash
+ IRON_RING_GUARD,
+ IRON_HONOR_GUARD,
+
+ // Shared
+ DARK_RUNE_ACOLYTE
+};
+
+struct ThorimTrashInfo
+{
+ uint32 Type;
+ uint32 Entry;
+ uint32 PrimaryAbility;
+ uint32 SecondaryAbility;
+ uint32 ThirdAbility;
+};
+
+uint8 const ThorimTrashCount = 13;
+ThorimTrashInfo const StaticThorimTrashInfo[ThorimTrashCount] =
+{
+ // Pre Phase
+ { BEHEMOTH, NPC_JORMUNGAR_BEHEMOTH, SPELL_ACID_BREATH, SPELL_SWEEP, 0 },
+ { MERCENARY_CAPTAIN, NPC_MERCENARY_CAPTAIN_A, SPELL_DEVASTATE, SPELL_HEROIC_SWIPE, SPELL_SUNDER_ARMOR },
+ { MERCENARY_SOLDIER, NPC_MERCENARY_SOLDIER_A, SPELL_BARBED_SHOT, SPELL_SHOOT, 0 },
+ { DARK_RUNE_ACOLYTE, NPC_DARK_RUNE_ACOLYTE_PRE, SPELL_RENEW, SPELL_GREATER_HEAL, SPELL_CIRCLE_OF_HEALING },
+ { MERCENARY_CAPTAIN, NPC_MERCENARY_CAPTAIN_H, SPELL_DEVASTATE, SPELL_HEROIC_SWIPE, SPELL_SUNDER_ARMOR },
+ { MERCENARY_SOLDIER, NPC_MERCENARY_SOLDIER_H, SPELL_BARBED_SHOT, SPELL_SHOOT, 0 },
+
+ // Arena Phase
+ { DARK_RUNE_CHAMPION, NPC_DARK_RUNE_CHAMPION, SPELL_MORTAL_STRIKE, SPELL_WHIRLWIND, 0 },
+ { DARK_RUNE_WARBRINGER, NPC_DARK_RUNE_WARBRINGER, SPELL_RUNIC_STRIKE, 0, 0 },
+ { DARK_RUNE_EVOKER, NPC_DARK_RUNE_EVOKER, SPELL_RUNIC_LIGHTNING, SPELL_RUNIC_SHIELD, SPELL_RUNIC_MENDING },
+ { DARK_RUNE_COMMONER, NPC_DARK_RUNE_COMMONER, SPELL_LOW_BLOW, SPELL_PUMMEL, 0 },
+
+ // Hall Way
+ { IRON_RING_GUARD, NPC_IRON_RING_GUARD, SPELL_WHIRLING_TRIP, SPELL_IMPALE, 0 },
+ { IRON_HONOR_GUARD, NPC_IRON_HONOR_GUARD, SPELL_CLEAVE, SPELL_SHIELD_SMASH, 0 },
+ { DARK_RUNE_ACOLYTE, NPC_DARK_RUNE_ACOLYTE, SPELL_RENEW, SPELL_GREATER_HEAL, 0 }
+};
+
+enum Actions
+{
+ ACTION_INCREASE_PREADDS_COUNT,
+ ACTION_ACTIVATE_RUNIC_SMASH,
+ ACTION_ACTIVATE_ADDS,
+ ACTION_PILLAR_CHARGED,
+ ACTION_START_HARD_MODE,
+ ACTION_BERSERK
+};
+
+struct SummonLocation
+{
+ Position pos;
+ uint32 entry;
+};
+
+SummonLocation const PreAddLocations[] =
+{
+ { { 2149.68f, -263.477f, 419.679f, 3.120f }, NPC_JORMUNGAR_BEHEMOTH },
+ { { 2131.31f, -271.640f, 419.840f, 2.188f }, NPC_MERCENARY_CAPTAIN_A },
+ { { 2127.24f, -259.182f, 419.974f, 5.917f }, NPC_MERCENARY_SOLDIER_A },
+ { { 2123.32f, -254.770f, 419.840f, 6.170f }, NPC_MERCENARY_SOLDIER_A },
+ { { 2120.10f, -258.990f, 419.840f, 6.250f }, NPC_MERCENARY_SOLDIER_A },
+ { { 2129.09f, -277.142f, 419.756f, 1.222f }, NPC_DARK_RUNE_ACOLYTE_PRE }
+};
+
+SummonLocation const ColossusAddLocations[] =
+{
+ { { 2218.38f, -297.50f, 412.18f, 1.030f }, NPC_IRON_RING_GUARD },
+ { { 2235.07f, -297.98f, 412.18f, 1.613f }, NPC_IRON_RING_GUARD },
+ { { 2235.26f, -338.34f, 412.18f, 1.589f }, NPC_IRON_RING_GUARD },
+ { { 2217.69f, -337.39f, 412.18f, 1.241f }, NPC_IRON_RING_GUARD },
+ { { 2227.58f, -308.30f, 412.18f, 1.591f }, NPC_DARK_RUNE_ACOLYTE },
+ { { 2227.47f, -345.37f, 412.18f, 1.566f }, NPC_DARK_RUNE_ACOLYTE }
+};
+
+SummonLocation const GiantAddLocations[] =
+{
+ { { 2198.05f, -428.77f, 419.95f, 6.056f }, NPC_IRON_HONOR_GUARD },
+ { { 2220.31f, -436.22f, 412.26f, 1.064f }, NPC_IRON_HONOR_GUARD },
+ { { 2158.88f, -441.73f, 438.25f, 0.127f }, NPC_IRON_HONOR_GUARD },
+ { { 2198.29f, -436.92f, 419.95f, 0.261f }, NPC_DARK_RUNE_ACOLYTE },
+ { { 2230.93f, -434.27f, 412.26f, 1.931f }, NPC_DARK_RUNE_ACOLYTE }
+};
+
+Position const SifSpawnPosition = { 2148.301f, -297.8453f, 438.3308f, 2.687807f };
+
+enum Data
+{
+ DATA_CHARGED_PILLAR = 1
+};
+
+enum DisplayIds
+{
+ THORIM_WEAPON_DISPLAY_ID = 45900
+};
+
+uint32 const LightningOrbPathSize = 8;
+G3D::Vector3 const LightningOrbPath[LightningOrbPathSize] =
+{
+ { 2134.889893f, -298.632996f, 438.247467f },
+ { 2134.570068f, -440.317993f, 438.247467f },
+ { 2167.820312f, -440.330261f, 438.247589f },
+ { 2213.394287f, -433.318298f, 412.665863f },
+ { 2227.766113f, -433.275818f, 412.177032f },
+ { 2227.551270f, -263.081085f, 412.176880f },
+ { 2202.208008f, -262.939270f, 412.168976f },
+ { 2182.310059f, -263.233093f, 414.739410f }
+};
+
+// used for trash jump calculation
+Position const ArenaCenter = { 2134.77f, -262.307f };
+
+// used for lightning field calculation
+Position const LightningFieldCenter = { 2135.178f, -321.122f };
+
+CircleBoundary const ArenaFloorCircle(ArenaCenter, 45.4);
+CircleBoundary const InvertedBalconyCircle(LightningFieldCenter, 32.0, true);
+
+CreatureBoundary const ArenaBoundaries =
+{
+ &ArenaFloorCircle,
+ &InvertedBalconyCircle
+};
+
+class HeightPositionCheck
+{
+ public:
+ HeightPositionCheck(bool ret) : _ret(ret) { }
+
+ bool operator()(Position const* pos) const
+ {
+ return pos->GetPositionZ() > THORIM_BALCONY_Z_CHECK == _ret;
+ }
+
+ private:
+ bool _ret;
+
+ static float const THORIM_BALCONY_Z_CHECK;
+};
+float const HeightPositionCheck::THORIM_BALCONY_Z_CHECK = 428.0f;
+
+class RunicSmashExplosionEvent : public BasicEvent
+{
+ public:
+ RunicSmashExplosionEvent(Creature* owner) : _owner(owner) { }
+
+ bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override
+ {
+ _owner->CastSpell((Unit*)nullptr, SPELL_RUNIC_SMASH);
+ return true;
+ }
+
+ private:
+ Creature* _owner;
+};
+
+class TrashJumpEvent : public BasicEvent
+{
+ public:
+ TrashJumpEvent(Creature* owner) : _owner(owner), _stage(0) { }
+
+ bool Execute(uint64 eventTime, uint32 /*updateTime*/) override
+ {
+ switch (_stage)
+ {
+ case 0:
+ _owner->CastSpell((Unit*)nullptr, SPELL_LEAP);
+ ++_stage;
+ _owner->m_Events.AddEvent(this, eventTime + 2000);
+ return false;
+ case 1:
+ _owner->SetReactState(REACT_AGGRESSIVE);
+ _owner->AI()->DoZoneInCombat(_owner);
+ _owner->AI()->SetBoundary(&ArenaBoundaries);
+ return true;
+ default:
+ break;
+ }
+
+ return true;
+ }
+
+ private:
+ Creature* _owner;
+ uint8 _stage;
+};
+
+class LightningFieldEvent : public BasicEvent
+{
+ public:
+ LightningFieldEvent(Creature* owner) : _owner(owner) { }
+
+ bool Execute(uint64 eventTime, uint32 /*updateTime*/) override
+ {
+ if (InstanceScript* instance = _owner->GetInstanceScript())
+ {
+ if (instance->GetBossState(BOSS_THORIM) == IN_PROGRESS)
+ {
+ _owner->CastSpell((Unit*)nullptr, SPELL_LIGHTNING_FIELD);
+ _owner->m_Events.AddEvent(this, eventTime + 1000);
+ return false;
+ }
+ }
+
+ _owner->InterruptNonMeleeSpells(false);
+ _owner->AI()->EnterEvadeMode();
+ return true;
+ }
+
+ private:
+ Creature* _owner;
};
class boss_thorim : public CreatureScript
@@ -47,17 +447,76 @@ class boss_thorim : public CreatureScript
{
boss_thorimAI(Creature* creature) : BossAI(creature, BOSS_THORIM)
{
+ _encounterFinished = false;
+ Initialize();
+ }
+
+ void Initialize()
+ {
+ _killedCount = 0;
+ _waveType = 0;
+ _hardMode = true;
+ _orbSummoned = false;
+ _dontStandInTheLightning = true;
}
void Reset() override
{
+ if (_encounterFinished)
+ return;
+
+ SetBoundary(nullptr);
_Reset();
+ Initialize();
+
+ me->SetReactState(REACT_PASSIVE);
+ me->SetDisableGravity(true);
+ me->SetControlled(true, UNIT_STATE_ROOT);
+ me->AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
+
+ events.SetPhase(PHASE_NULL);
+
+ // Respawn Mini Bosses
+ for (uint8 i = DATA_RUNIC_COLOSSUS; i <= DATA_RUNE_GIANT; ++i)
+ if (Creature* miniBoss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(i)))
+ miniBoss->Respawn(true);
+
+ // Spawn Pre Phase Adds
+ for (SummonLocation const& s : PreAddLocations)
+ me->SummonCreature(s.entry, s.pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
+
+ if (GameObject* lever = instance->GetGameObject(DATA_THORIM_LEVER))
+ lever->AddFlag(GO_FLAG_NOT_SELECTABLE);
+
+ // Remove trigger auras
+ if (Creature* pillar = ObjectAccessor::GetCreature(*me, _activePillarGUID))
+ pillar->RemoveAllAuras();
+
+ if (Creature* controller = instance->GetCreature(DATA_THORIM_CONTROLLER))
+ controller->RemoveAllAuras();
+
+ _activePillarGUID.Clear();
}
- void EnterEvadeMode(EvadeReason why) override
+ void EnterEvadeMode(EvadeReason /*why*/) override
{
- Talk(SAY_WIPE);
- _EnterEvadeMode(why);
+ summons.DespawnAll();
+ _DespawnAtEvade();
+ }
+
+ void SetGUID(ObjectGuid guid, int32 type) override
+ {
+ if (type == DATA_CHARGED_PILLAR)
+ {
+ _activePillarGUID = guid;
+
+ if (Creature* pillar = ObjectAccessor::GetCreature(*me, _activePillarGUID))
+ {
+ pillar->CastSpell(pillar, SPELL_LIGHTNING_ORB_CHARGED, true);
+ pillar->CastSpell((Unit*)nullptr, SPELL_LIGHTNING_PILLAR_2);
+ events.ScheduleEvent(EVENT_LIGHTNING_CHARGE, 8000, 0, PHASE_2);
+ }
+ }
}
void KilledUnit(Unit* who) override
@@ -66,27 +525,410 @@ class boss_thorim : public CreatureScript
Talk(SAY_SLAY);
}
- void JustDied(Unit* /*killer*/) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
{
- Talk(SAY_DEATH);
+ if (spellInfo->Id == SPELL_TOUCH_OF_DOMINION_TRIGGERED)
+ {
+ if (Creature* sif = instance->GetCreature(DATA_SIF))
+ {
+ sif->AI()->Talk(SAY_SIF_DESPAWN);
+ sif->DespawnOrUnsummon(6000);
+ _hardMode = false;
+ }
+ }
+ }
+
+ void SpellHitTarget(Unit* who, SpellInfo const* spellInfo) override
+ {
+ if (who->GetTypeId() == TYPEID_PLAYER && spellInfo->Id == SPELL_LIGHTNING_RELEASE)
+ _dontStandInTheLightning = false;
+ }
+
+ void FinishEncounter()
+ {
+ if (_encounterFinished)
+ return;
+
+ _encounterFinished = true;
+
+ DoCastAOE(SPELL_CREDIT_KILL, true); // before change faction
+
+ me->SetReactState(REACT_PASSIVE);
+ me->InterruptNonMeleeSpells(true);
+ me->RemoveAllAttackers();
+ me->AttackStop();
+ me->SetFaction(FACTION_FRIENDLY);
+ me->AddUnitFlag(UNIT_FLAG_RENAME);
+
+ if (Creature* controller = instance->GetCreature(DATA_THORIM_CONTROLLER))
+ controller->RemoveAllAuras();
+ if (Creature* pillar = ObjectAccessor::GetCreature(*me, _activePillarGUID))
+ pillar->RemoveAllAuras();
+
+ if (_hardMode)
+ {
+ if (Creature* sif = instance->GetCreature(DATA_SIF))
+ {
+ summons.Despawn(sif);
+ sif->DespawnOrUnsummon(10000);
+ }
+ }
+
_JustDied();
+
+ Talk(SAY_DEATH);
+ events.ScheduleEvent(EVENT_OUTRO_1, 4000);
+ events.ScheduleEvent(EVENT_OUTRO_2, _hardMode ? 8000 : 11000);
+ events.ScheduleEvent(EVENT_OUTRO_3, _hardMode ? 19000 : 21000);
+
+ me->m_Events.AddEvent(new KeeperDespawnEvent(me), me->m_Events.CalculateTime(35000));
+ }
+
+ void MovementInform(uint32 type, uint32 id) override
+ {
+ if (type != EFFECT_MOTION_TYPE || id != EVENT_JUMP)
+ return;
+
+ me->getThreatManager().resetAllAggro();
+ SetBoundary(&ArenaBoundaries);
}
void EnterCombat(Unit* /*who*/) override
{
- Talk(SAY_AGGRO);
_EnterCombat();
+ Talk(SAY_AGGRO_1);
+
+ events.SetPhase(PHASE_1);
+
+ events.ScheduleEvent(EVENT_SAY_AGGRO_2, 9000, 0, PHASE_1);
+ events.ScheduleEvent(EVENT_SAY_SIF_START, 16500, 0, PHASE_1);
+ events.ScheduleEvent(EVENT_START_SIF_CHANNEL, 22500, 0, PHASE_1);
+
+ events.ScheduleEvent(EVENT_STORMHAMMER, 40000, 0, PHASE_1);
+ events.ScheduleEvent(EVENT_CHARGE_ORB, 30000, 0, PHASE_1);
+ events.ScheduleEvent(EVENT_SUMMON_ADDS, 15000, 0, PHASE_1);
+ events.ScheduleEvent(EVENT_BERSERK, 369000);
+
+ DoCast(me, SPELL_SHEATH_OF_LIGHTNING);
+
+ if (Creature* runicColossus = instance->GetCreature(DATA_RUNIC_COLOSSUS))
+ {
+ runicColossus->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
+ runicColossus->AI()->DoAction(ACTION_ACTIVATE_ADDS);
+ }
+
+ if (GameObject* lever = instance->GetGameObject(DATA_THORIM_LEVER))
+ lever->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
+
+ // Summon Sif
+ me->SummonCreature(NPC_SIF, SifSpawnPosition);
+ }
+
+ void JustSummoned(Creature* summon) override
+ {
+ switch (summon->GetEntry())
+ {
+ case NPC_LIGHTNING_ORB:
+ {
+ summon->SetReactState(REACT_PASSIVE);
+ summon->CastSpell(summon, SPELL_LIGHTNING_DESTRUCTION, true);
+
+ summon->GetMotionMaster()->MovePoint(EVENT_CHARGE_PREPATH, LightningOrbPath[LightningOrbPathSize - 1].x, LightningOrbPath[LightningOrbPathSize - 1].y, LightningOrbPath[LightningOrbPathSize - 1].z, false);
+
+ Movement::PointsArray path(LightningOrbPath, LightningOrbPath + LightningOrbPathSize);
+
+ Movement::MoveSplineInit init(summon);
+ init.MovebyPath(path);
+ init.Launch();
+ break;
+ }
+ case NPC_DARK_RUNE_CHAMPION:
+ case NPC_DARK_RUNE_WARBRINGER:
+ case NPC_DARK_RUNE_EVOKER:
+ case NPC_DARK_RUNE_COMMONER:
+ summon->SetReactState(REACT_PASSIVE);
+ summon->m_Events.AddEvent(new TrashJumpEvent(summon), summon->m_Events.CalculateTime(3000));
+ break;
+ case NPC_SIF:
+ summon->SetReactState(REACT_PASSIVE);
+ break;
+ default:
+ break;
+ }
+
+ BossAI::JustSummoned(summon);
}
- void UpdateAI(uint32 /*diff*/) override
+ void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
- //SPELLS @todo
- //
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_SAY_AGGRO_2:
+ Talk(SAY_AGGRO_2);
+ break;
+ case EVENT_SAY_SIF_START:
+ if (Creature* sif = instance->GetCreature(DATA_SIF))
+ sif->AI()->Talk(SAY_SIF_START);
+ break;
+ case EVENT_START_SIF_CHANNEL:
+ if (Creature* sif = instance->GetCreature(DATA_SIF))
+ sif->CastSpell(me, SPELL_TOUCH_OF_DOMINION);
+ break;
+ case EVENT_STORMHAMMER:
+ DoCast(SPELL_STORMHAMMER);
+ events.Repeat(15000, 20000);
+ break;
+ case EVENT_CHARGE_ORB:
+ DoCastAOE(SPELL_CHARGE_ORB);
+ events.Repeat(15000, 20000);
+ break;
+ case EVENT_SUMMON_ADDS:
+ SummonWave();
+ events.Repeat(_orbSummoned ? 3000 : 10000);
+ break;
+ case EVENT_JUMPDOWN:
+ if (_hardMode)
+ if (Creature* sif = instance->GetCreature(DATA_SIF))
+ sif->AI()->DoAction(ACTION_START_HARD_MODE);
+ me->RemoveAurasDueToSpell(SPELL_SHEATH_OF_LIGHTNING);
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->SetDisableGravity(false);
+ me->SetControlled(false, UNIT_STATE_ROOT);
+ me->GetMotionMaster()->MoveJump(2134.8f, -263.056f, 419.983f, me->GetOrientation(), 30.0f, 20.0f);
+ events.ScheduleEvent(EVENT_START_PERIODIC_CHARGE, 2000, 0, PHASE_2);
+ events.ScheduleEvent(EVENT_UNBALANCING_STRIKE, 15000, 0, PHASE_2);
+ events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 20000, 0, PHASE_2);
+ break;
+ case EVENT_UNBALANCING_STRIKE:
+ DoCastVictim(SPELL_UNBALANCING_STRIKE);
+ events.Repeat(15000, 20000);
+ break;
+ case EVENT_CHAIN_LIGHTNING:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
+ DoCast(target, SPELL_CHAIN_LIGHTNING);
+ events.Repeat(7000, 15000);
+ break;
+ case EVENT_START_PERIODIC_CHARGE:
+ if (Creature* controller = instance->GetCreature(DATA_THORIM_CONTROLLER))
+ controller->CastSpell(controller, SPELL_ACTIVATE_LIGHTNING_ORB_PERIODIC, true);
+ break;
+ case EVENT_LIGHTNING_CHARGE:
+ if (Creature* pillar = ObjectAccessor::GetCreature(*me, _activePillarGUID))
+ DoCast(pillar, SPELL_LIGHTNING_RELEASE);
+ break;
+ case EVENT_BERSERK:
+ if (events.IsInPhase(PHASE_1))
+ {
+ Talk(SAY_WIPE);
+ DoCastAOE(SPELL_BERSERK_PHASE_1, true);
+ DoCast(me, SPELL_SUMMON_LIGHTNING_ORB, true);
+ }
+ else
+ {
+ Talk(SAY_BERSERK);
+ DoCast(me, SPELL_BERSERK_PHASE_2, true);
+ }
+ break;
+ case EVENT_ACTIVATE_LIGHTNING_FIELD:
+ {
+ std::list<Creature*> triggers;
+ me->GetCreatureListWithEntryInGrid(triggers, NPC_THORIM_EVENT_BUNNY, 100.0f);
+ triggers.remove_if([](Creature* bunny)
+ {
+ if (HeightPositionCheck(false)(bunny))
+ return true;
+ return LightningFieldCenter.GetExactDist2dSq(bunny) > 1296.0f;
+ });
+
+ uint64 timer = 1000;
+ for (Creature* bunny : triggers)
+ bunny->m_Events.AddEvent(new LightningFieldEvent(bunny), bunny->m_Events.CalculateTime(timer += 100));
+
+ triggers.remove_if([](Creature* bunny)
+ {
+ return LightningFieldCenter.GetExactDist2dSq(bunny) < 576.0f;
+ });
+
+ triggers.sort([](Creature* a, Creature* b)
+ {
+ return a->GetPositionX() < b->GetPositionX();
+ });
+
+ for (auto itr = triggers.cbegin(); itr != triggers.cend();)
+ {
+ auto prev = itr++;
+ if (itr != triggers.end())
+ (*prev)->CastSpell(*itr, SPELL_LIGHTNING_BEAM_CHANNEL);
+ }
+ break;
+ }
+ case EVENT_OUTRO_1:
+ Talk(_hardMode ? SAY_END_HARD_1 : SAY_END_NORMAL_1);
+ if (_hardMode)
+ DoCast(me, SPELL_STORMHAMMER_SIF);
+ break;
+ case EVENT_OUTRO_2:
+ Talk(_hardMode ? SAY_END_HARD_2 : SAY_END_NORMAL_2);
+ if (_hardMode)
+ if (Creature* sif = instance->GetCreature(DATA_SIF))
+ sif->SetStandState(UNIT_STAND_STATE_DEAD);
+ break;
+ case EVENT_OUTRO_3:
+ Talk(_hardMode ? SAY_END_HARD_3 : SAY_END_NORMAL_3);
+ break;
+ default:
+ break;
+ }
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+ }
+
DoMeleeAttackIfReady();
}
+
+ void DoAction(int32 action) override
+ {
+ switch (action)
+ {
+ case ACTION_BERSERK:
+ if (events.IsInPhase(PHASE_2))
+ return;
+
+ if (!_orbSummoned)
+ {
+ _orbSummoned = true;
+ events.RescheduleEvent(EVENT_BERSERK, 1000);
+ }
+ return;
+ case ACTION_INCREASE_PREADDS_COUNT:
+ if (++_killedCount >= 6)
+ {
+ // Event starts
+ me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
+ DoZoneInCombat(me);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ void GetTrashSpawnTriggers(std::list<Creature*>& triggerList, uint32 count = 1)
+ {
+ me->GetCreatureListWithEntryInGrid(triggerList, NPC_THORIM_EVENT_BUNNY, 100.0f);
+ triggerList.remove_if([](Creature* bunny)
+ {
+ if (HeightPositionCheck(false)(bunny))
+ return true;
+ return ArenaCenter.GetExactDist2dSq(bunny) < 3025.0f;
+ });
+
+ if (triggerList.empty())
+ return;
+
+ if (count == 1)
+ {
+ Creature* bunny = Trinity::Containers::SelectRandomContainerElement(triggerList);
+ triggerList.clear();
+ triggerList.push_back(bunny);
+ }
+ else
+ Trinity::Containers::RandomResize(triggerList, count);
+ }
+
+ void SummonWave()
+ {
+ switch (_waveType)
+ {
+ case 0:
+ {
+ // Dark Rune Commoner
+ std::list<Creature*> triggers;
+ GetTrashSpawnTriggers(triggers, urand(5, 6));
+
+ for (Creature* bunny : triggers)
+ me->SummonCreature(StaticThorimTrashInfo[6 + 3].Entry, *bunny, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
+
+ ++_waveType;
+ break;
+ }
+ case 1:
+ if (urand(0, 1))
+ {
+ // Dark Rune Champion or Dark Rune Evoker
+ std::list<Creature*> triggers;
+ GetTrashSpawnTriggers(triggers, urand(2, 4));
+
+ for (Creature* bunny : triggers)
+ me->SummonCreature(StaticThorimTrashInfo[6 + RAND(0, 2)].Entry, *bunny, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
+ }
+ else
+ {
+ // Dark Rune Warbringer
+ std::list<Creature*> triggers;
+ GetTrashSpawnTriggers(triggers);
+
+ for (Creature* bunny : triggers)
+ me->SummonCreature(StaticThorimTrashInfo[6 + 1].Entry, *bunny, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
+ }
+ --_waveType;
+ break;
+ }
+ }
+
+ bool CanStartPhase2(Unit* actor) const
+ {
+ if (actor->GetTypeId() != TYPEID_PLAYER || !me->IsWithinDistInMap(actor, 10.0f))
+ return false;
+
+ Creature* runicColossus = instance->GetCreature(DATA_RUNIC_COLOSSUS);
+ Creature* runeGiant = instance->GetCreature(DATA_RUNE_GIANT);
+ return runicColossus && !runicColossus->IsAlive() && runeGiant && !runeGiant->IsAlive();
+ }
+
+ void DamageTaken(Unit* attacker, uint32& damage) override
+ {
+ if (events.IsInPhase(PHASE_1) && CanStartPhase2(attacker))
+ {
+ Talk(SAY_JUMPDOWN);
+ events.SetPhase(PHASE_2);
+ events.ScheduleEvent(EVENT_JUMPDOWN, 8000);
+ events.ScheduleEvent(EVENT_ACTIVATE_LIGHTNING_FIELD, 15000);
+ events.RescheduleEvent(EVENT_BERSERK, 300000, 0, PHASE_2);
+
+ if (Creature* sif = instance->GetCreature(DATA_SIF))
+ sif->InterruptNonMeleeSpells(false);
+
+ // Hard Mode
+ if (_hardMode)
+ DoCastAOE(SPELL_CREDIT_SIFFED, true);
+ }
+ else if (me->HealthBelowPctDamaged(1, damage))
+ {
+ damage = 0;
+ FinishEncounter();
+ }
+ }
+
+ private:
+ ObjectGuid _activePillarGUID;
+ uint8 _killedCount;
+ uint8 _waveType;
+ bool _hardMode;
+ bool _encounterFinished;
+ bool _orbSummoned;
+ bool _dontStandInTheLightning;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -95,7 +937,1234 @@ class boss_thorim : public CreatureScript
}
};
+struct npc_thorim_trashAI : public ScriptedAI
+{
+ npc_thorim_trashAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ for (uint8 i = 0; i < ThorimTrashCount; ++i)
+ if (me->GetEntry() == StaticThorimTrashInfo[i].Entry)
+ _info = &StaticThorimTrashInfo[i];
+
+ ASSERT(_info);
+ }
+
+ struct AIHelper
+ {
+ /// returns heal amount of the given spell including hots
+ static uint32 GetTotalHeal(SpellInfo const* spellInfo, Unit const* caster)
+ {
+ uint32 heal = 0;
+ for (SpellEffectInfo const* effect : spellInfo->GetEffects())
+ {
+ if (effect->IsEffect(SPELL_EFFECT_HEAL))
+ heal += effect->CalcValue(caster);
+
+ if (effect->IsEffect(SPELL_EFFECT_APPLY_AURA) && effect->IsAura(SPELL_AURA_PERIODIC_HEAL))
+ heal += spellInfo->GetMaxTicks() * effect->CalcValue(caster);
+ }
+ return heal;
+ }
+
+ /// returns remaining heal amount on given target
+ static uint32 GetRemainingHealOn(Unit* target)
+ {
+ uint32 heal = 0;
+ Unit::AuraEffectList const& auras = target->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL);
+ for (AuraEffect const* aurEff : auras)
+ heal += aurEff->GetAmount() * (aurEff->GetTotalTicks() - aurEff->GetTickNumber());
+
+ return heal;
+ }
+
+ class MostHPMissingInRange
+ {
+ public:
+ MostHPMissingInRange(Unit const* referer, float range, uint32 hp, uint32 exclAura = 0, bool exclSelf = false)
+ : _referer(referer), _range(range), _hp(hp), _exclAura(exclAura), _exclSelf(exclSelf) { }
+
+ bool operator()(Unit* u)
+ {
+ if (_exclSelf && u == _referer)
+ return false;
+
+ if (_exclAura && u->HasAura(_exclAura))
+ return false;
+
+ if ((u->GetHealth() + GetRemainingHealOn(u) + _hp) > u->GetMaxHealth())
+ return false;
+
+ uint32 missingHP = u->GetMaxHealth() - u->GetHealth();
+ if (u->IsAlive() && _referer->IsFriendlyTo(u) && _referer->IsWithinDistInMap(u, _range) && missingHP > _hp)
+ {
+ _hp = missingHP;
+ return true;
+ }
+
+ return false;
+ }
+
+ private:
+ Unit const* _referer;
+ float _range;
+ uint32 _hp;
+ uint32 _exclAura;
+ bool _exclSelf;
+ };
+
+ static Unit* GetUnitWithMostMissingHp(SpellInfo const* spellInfo, Unit* caster)
+ {
+ // use positive range, it's a healing spell
+ float const range = spellInfo->GetMaxRange(true);
+ uint32 const heal = GetTotalHeal(spellInfo, caster);
+
+ Unit* target = nullptr;
+ Trinity::MostHPMissingInRange checker(caster, range, heal);
+ Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(caster, target, checker);
+ Cell::VisitGridObjects(caster, searcher, 60.0f);
+
+ return target;
+ }
+
+ static Unit* GetHealTarget(SpellInfo const* spellInfo, Unit* caster)
+ {
+ Unit* healTarget = nullptr;
+ if (!spellInfo->HasAttribute(SPELL_ATTR1_CANT_TARGET_SELF) && !roll_chance_f(caster->GetHealthPct()) && ((caster->GetHealth() + GetRemainingHealOn(caster) + GetTotalHeal(spellInfo, caster)) <= caster->GetMaxHealth()))
+ healTarget = caster;
+ else
+ healTarget = GetUnitWithMostMissingHp(spellInfo, caster);
+
+ return healTarget;
+ }
+ };
+
+ bool UseAbility(uint32 spellId)
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId, GetDifficulty());
+ if (!spellInfo)
+ return false;
+
+ Unit* target = nullptr;
+ if (AIHelper::GetTotalHeal(spellInfo, me))
+ target = AIHelper::GetHealTarget(spellInfo, me);
+ else
+ target = me->GetVictim();
+
+ if (!target)
+ return false;
+
+ if (_info->Type == MERCENARY_SOLDIER)
+ {
+ bool allowMove = true;
+ if (me->IsInRange(target, spellInfo->GetMinRange(), spellInfo->GetMaxRange()))
+ allowMove = false;
+
+ if (IsCombatMovementAllowed() != allowMove)
+ {
+ SetCombatMovement(allowMove);
+
+ // need relaunch movement
+ ScriptedAI::AttackStart(target);
+
+ // give some time to allow reposition, try again in a second
+ if (allowMove)
+ return false;
+ }
+ }
+
+ DoCast(target, spellId);
+ return true;
+ }
+
+ void UpdateAI(uint32 diff) final override
+ {
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ ExecuteEvent(eventId);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+ }
+
+ if (_info->Type == DARK_RUNE_ACOLYTE)
+ DoSpellAttackIfReady(SPELL_HOLY_SMITE);
+ else
+ DoMeleeAttackIfReady();
+ }
+
+ virtual void ExecuteEvent(uint32 eventId) = 0;
+
+protected:
+ InstanceScript* _instance;
+ EventMap _events;
+
+ ThorimTrashInfo const* _info = nullptr;
+};
+
+class npc_thorim_pre_phase : public CreatureScript
+{
+ public:
+ npc_thorim_pre_phase() : CreatureScript("npc_thorim_pre_phase") { }
+
+ struct npc_thorim_pre_phaseAI : public npc_thorim_trashAI
+ {
+ npc_thorim_pre_phaseAI(Creature* creature) : npc_thorim_trashAI(creature)
+ {
+ me->setActive(true); // prevent grid unload
+ }
+
+ void Reset() override
+ {
+ _events.Reset();
+ if (_info->PrimaryAbility)
+ _events.ScheduleEvent(EVENT_PRIMARY_ABILITY, urand(3000, 6000));
+ if (_info->SecondaryAbility)
+ _events.ScheduleEvent(EVENT_SECONDARY_ABILITY, _info->SecondaryAbility == SPELL_SHOOT ? 2000 : urand(12000, 15000));
+ if (_info->ThirdAbility)
+ _events.ScheduleEvent(EVENT_THIRD_ABILITY, urand(6000, 8000));
+ if (_info->Type == MERCENARY_SOLDIER)
+ SetCombatMovement(false);
+ }
+
+ void JustDied(Unit* /*victim*/) override
+ {
+ if (Creature* thorim = _instance->GetCreature(BOSS_THORIM))
+ thorim->AI()->DoAction(ACTION_INCREASE_PREADDS_COUNT);
+ }
+
+ bool ShouldSparWith(Unit const* target) const override
+ {
+ return !target->GetAffectingPlayer();
+ }
+
+ void DamageTaken(Unit* attacker, uint32& damage) override
+ {
+ // nullify spell damage
+ if (!attacker->GetAffectingPlayer())
+ damage = 0;
+ }
+
+ void ExecuteEvent(uint32 eventId) override
+ {
+ switch (eventId)
+ {
+ case EVENT_PRIMARY_ABILITY:
+ if (UseAbility(_info->PrimaryAbility))
+ _events.ScheduleEvent(eventId, urand(15000, 20000));
+ else
+ _events.ScheduleEvent(eventId, 1000);
+ break;
+ case EVENT_SECONDARY_ABILITY:
+ if (UseAbility(_info->SecondaryAbility))
+ _events.ScheduleEvent(eventId, _info->SecondaryAbility == SPELL_SHOOT ? 2000 : urand(4000, 8000));
+ else
+ _events.ScheduleEvent(eventId, 1000);
+ break;
+ case EVENT_THIRD_ABILITY:
+ if (UseAbility(_info->ThirdAbility))
+ _events.ScheduleEvent(eventId, urand(6000, 8000));
+ else
+ _events.ScheduleEvent(eventId, 1000);
+ break;
+ default:
+ break;
+ }
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetUlduarAI<npc_thorim_pre_phaseAI>(creature);
+ }
+};
+
+class npc_thorim_arena_phase : public CreatureScript
+{
+ public:
+ npc_thorim_arena_phase() : CreatureScript("npc_thorim_arena_phase") { }
+
+ struct npc_thorim_arena_phaseAI : public npc_thorim_trashAI
+ {
+ npc_thorim_arena_phaseAI(Creature* creature) : npc_thorim_trashAI(creature)
+ {
+ switch (_info->Type)
+ {
+ case DARK_RUNE_CHAMPION:
+ case DARK_RUNE_WARBRINGER:
+ case DARK_RUNE_COMMONER:
+ case DARK_RUNE_EVOKER:
+ _isInArena = true;
+ break;
+ case DARK_RUNE_ACOLYTE:
+ {
+ _isInArena = (_info->Entry == NPC_DARK_RUNE_ACOLYTE_PRE);
+ SetBoundary(&ArenaBoundaries, !_isInArena);
+ break;
+ }
+ default:
+ _isInArena = false;
+ break;
+ }
+ }
+
+ bool CanAIAttack(Unit const* who) const override
+ {
+ // don't try to attack players in balcony
+ if (_isInArena && HeightPositionCheck(true)(who))
+ return false;
+
+ return CheckBoundary(who);
+ }
+
+ void Reset() override
+ {
+ _events.Reset();
+ if (_info->PrimaryAbility)
+ _events.ScheduleEvent(EVENT_PRIMARY_ABILITY, urand(3000, 6000));
+ if (_info->SecondaryAbility)
+ _events.ScheduleEvent(EVENT_SECONDARY_ABILITY, urand(7000, 9000));
+ if (_info->ThirdAbility)
+ _events.ScheduleEvent(EVENT_THIRD_ABILITY, urand(6000, 8000));
+ if (_info->Type == DARK_RUNE_CHAMPION)
+ _events.ScheduleEvent(EVENT_ABILITY_CHARGE, 8000);
+ }
+
+ void EnterCombat(Unit* /*who*/) override
+ {
+ if (_info->Type == DARK_RUNE_WARBRINGER)
+ DoCast(me, SPELL_AURA_OF_CELERITY);
+
+ if (!_isInArena)
+ if (Creature* colossus = _instance->GetCreature(DATA_RUNIC_COLOSSUS))
+ colossus->AI()->DoAction(ACTION_ACTIVATE_RUNIC_SMASH);
+ }
+
+ void EnterEvadeMode(EvadeReason why) override
+ {
+ if (why != EVADE_REASON_NO_HOSTILES && why != EVADE_REASON_BOUNDARY)
+ return;
+
+ // this should only happen if theres no alive player in the arena -> summon orb
+ if (Creature* thorim = _instance->GetCreature(BOSS_THORIM))
+ thorim->AI()->DoAction(ACTION_BERSERK);
+ ScriptedAI::EnterEvadeMode(why);
+ }
+
+ void ExecuteEvent(uint32 eventId) override
+ {
+ switch (eventId)
+ {
+ case EVENT_PRIMARY_ABILITY:
+ if (UseAbility(_info->PrimaryAbility))
+ _events.Repeat(3000, 6000);
+ else
+ _events.Repeat(1000);
+ break;
+ case EVENT_SECONDARY_ABILITY:
+ if (UseAbility(_info->SecondaryAbility))
+ _events.Repeat(12000, 16000);
+ else
+ _events.Repeat(1000);
+ break;
+ case EVENT_THIRD_ABILITY:
+ if (UseAbility(_info->ThirdAbility))
+ _events.Repeat(6000, 8000);
+ else
+ _events.Repeat(1000);
+ break;
+ case EVENT_ABILITY_CHARGE:
+ {
+ Unit* referer = me;
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, [referer](Unit* unit){ return unit->GetTypeId() == TYPEID_PLAYER && unit->IsInRange(referer, 8.0f, 25.0f); }))
+ DoCast(target, SPELL_CHARGE);
+ _events.ScheduleEvent(eventId, 12000);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ private:
+ bool _isInArena;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetUlduarAI<npc_thorim_arena_phaseAI>(creature);
+ }
+};
+
+struct npc_thorim_minibossAI : public ScriptedAI
+{
+ npc_thorim_minibossAI(Creature* creature) : ScriptedAI(creature), _summons(me)
+ {
+ _instance = creature->GetInstanceScript();
+
+ SetBoundary(&ArenaBoundaries, true);
+ }
+
+ bool CanAIAttack(Unit const* who) const final override
+ {
+ return CheckBoundary(who);
+ }
+
+ void JustSummoned(Creature* summon) final override
+ {
+ _summons.Summon(summon);
+ }
+
+ void SummonedCreatureDespawn(Creature* summon) final override
+ {
+ _summons.Despawn(summon);
+ }
+
+ void DoAction(int32 action) override
+ {
+ if (action == ACTION_ACTIVATE_ADDS)
+ {
+ for (ObjectGuid const& guid : _summons)
+ if (Creature* summon = ObjectAccessor::GetCreature(*me, guid))
+ summon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
+ }
+ }
+
+protected:
+ InstanceScript* _instance;
+ EventMap _events;
+ SummonList _summons;
+};
+
+class npc_runic_colossus : public CreatureScript
+{
+ public:
+ npc_runic_colossus() : CreatureScript("npc_runic_colossus") { }
+
+ struct npc_runic_colossusAI : public npc_thorim_minibossAI
+ {
+ npc_runic_colossusAI(Creature* creature) : npc_thorim_minibossAI(creature)
+ {
+ Initialize();
+ }
+
+ void Initialize()
+ {
+ _runicActive = false;
+ }
+
+ void Reset() override
+ {
+ Initialize();
+ _events.Reset();
+
+ // close the Runic Door
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_RUNIC_DOOR), false);
+
+ // Spawn trashes
+ _summons.DespawnAll();
+ for (SummonLocation const& s : ColossusAddLocations)
+ me->SummonCreature(s.entry, s.pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
+ }
+
+ void MoveInLineOfSight(Unit* /*who*/) override
+ {
+ // don't enter combat
+ }
+
+ void DoAction(int32 action) override
+ {
+ npc_thorim_minibossAI::DoAction(action);
+
+ if (_runicActive)
+ return;
+
+ if (action == ACTION_ACTIVATE_RUNIC_SMASH)
+ {
+ _runicActive = true;
+ _events.ScheduleEvent(EVENT_RUNIC_SMASH, 7000);
+ }
+ }
+
+ void JustDied(Unit* /*victim*/) override
+ {
+ // open the Runic Door
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_RUNIC_DOOR), true);
+
+ if (Creature* thorim = _instance->GetCreature(BOSS_THORIM))
+ thorim->AI()->Talk(SAY_SPECIAL);
+
+ if (Creature* giant = _instance->GetCreature(DATA_RUNE_GIANT))
+ {
+ giant->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
+ giant->AI()->DoAction(ACTION_ACTIVATE_ADDS);
+ }
+ }
+
+ void EnterCombat(Unit* /*who*/) override
+ {
+ DoZoneInCombat();
+ _events.Reset();
+ _events.ScheduleEvent(EVENT_RUNIC_BARRIER, urand(12000, 15000));
+ _events.ScheduleEvent(EVENT_SMASH, urand(15000, 18000));
+ _events.ScheduleEvent(EVENT_RUNIC_CHARGE, urand(20000, 24000));
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ _events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_RUNIC_BARRIER:
+ Talk(EMOTE_RUNIC_BARRIER);
+ DoCastAOE(SPELL_RUNIC_BARRIER);
+ _events.Repeat(35000, 45000);
+ break;
+ case EVENT_SMASH:
+ DoCastAOE(SPELL_SMASH);
+ _events.Repeat(15000, 18000);
+ break;
+ case EVENT_RUNIC_CHARGE:
+ {
+ Unit* referer = me;
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, [referer](Unit* unit){ return unit->GetTypeId() == TYPEID_PLAYER && unit->IsInRange(referer, 8.0f, 40.0f); }))
+ DoCast(target, SPELL_RUNIC_CHARGE);
+ _events.Repeat(20000);
+ break;
+ }
+ case EVENT_RUNIC_SMASH:
+ DoCast(me, RAND(SPELL_RUNIC_SMASH_LEFT, SPELL_RUNIC_SMASH_RIGHT));
+ _events.Repeat(6000);
+ break;
+ default:
+ break;
+ }
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+ }
+
+ if (!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ bool _runicActive;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetUlduarAI<npc_runic_colossusAI>(creature);
+ }
+};
+
+class npc_ancient_rune_giant : public CreatureScript
+{
+ public:
+ npc_ancient_rune_giant() : CreatureScript("npc_ancient_rune_giant") { }
+
+ struct npc_ancient_rune_giantAI : public npc_thorim_minibossAI
+ {
+ npc_ancient_rune_giantAI(Creature* creature) : npc_thorim_minibossAI(creature) { }
+
+ void Reset() override
+ {
+ _events.Reset();
+
+ // close the Stone Door
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_STONE_DOOR), false);
+
+ // Spawn trashes
+ _summons.DespawnAll();
+ for (SummonLocation const& s : GiantAddLocations)
+ me->SummonCreature(s.entry, s.pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
+ }
+
+ void EnterCombat(Unit* /*who*/) override
+ {
+ DoZoneInCombat();
+ _events.Reset();
+ _events.ScheduleEvent(EVENT_RUNIC_FORTIFICATION, 1);
+ _events.ScheduleEvent(EVENT_STOMP, urand(10000, 12000));
+ _events.ScheduleEvent(EVENT_RUNE_DETONATION, 25000);
+ }
+
+ void JustDied(Unit* /*victim*/) override
+ {
+ // opem the Stone Door
+ _instance->HandleGameObject(_instance->GetGuidData(DATA_STONE_DOOR), true);
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_RUNIC_FORTIFICATION:
+ Talk(EMOTE_RUNIC_MIGHT);
+ DoCastAOE(SPELL_RUNIC_FORTIFICATION);
+ break;
+ case EVENT_STOMP:
+ DoCastAOE(SPELL_STOMP);
+ _events.Repeat(10000, 12000);
+ break;
+ case EVENT_RUNE_DETONATION:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true))
+ DoCast(target, SPELL_RUNE_DETONATION);
+ _events.Repeat(10000, 12000);
+ break;
+ default:
+ break;
+ }
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetUlduarAI<npc_ancient_rune_giantAI>(creature);
+ }
+};
+
+class npc_sif : public CreatureScript
+{
+ public:
+ npc_sif() : CreatureScript("npc_sif") { }
+
+ struct npc_sifAI : public ScriptedAI
+ {
+ npc_sifAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ _instance = creature->GetInstanceScript();
+ }
+
+ void Reset() override
+ {
+ _events.Reset();
+ }
+
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
+ {
+ if (spellInfo->Id == SPELL_STORMHAMMER_SIF)
+ {
+ me->InterruptSpell(CURRENT_GENERIC_SPELL);
+ me->SetReactState(REACT_PASSIVE);
+ me->AttackStop();
+ }
+ }
+
+ void DoAction(int32 action) override
+ {
+ if (action == ACTION_START_HARD_MODE)
+ {
+ me->SetReactState(REACT_AGGRESSIVE);
+ DoZoneInCombat(me, 250.0f);
+ Talk(SAY_SIF_EVENT);
+ _events.Reset();
+ _events.ScheduleEvent(EVENT_FROSTBOLT, 2000);
+ _events.ScheduleEvent(EVENT_FROSTBOLT_VOLLEY, 15000);
+ _events.ScheduleEvent(EVENT_BLINK, urand(20000, 25000));
+ _events.ScheduleEvent(EVENT_BLIZZARD, 30000);
+ }
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_BLINK:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
+ DoCast(target, SPELL_BLINK);
+ _events.ScheduleEvent(EVENT_FROST_NOVA, 0);
+ _events.Repeat(20000, 25000);
+ return;
+ case EVENT_FROST_NOVA:
+ DoCastAOE(SPELL_FROSTNOVA);
+ return;
+ case EVENT_FROSTBOLT:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
+ DoCast(target, SPELL_FROSTBOLT);
+ _events.Repeat(2000);
+ return;
+ case EVENT_FROSTBOLT_VOLLEY:
+ DoCastAOE(SPELL_FROSTBOLT_VOLLEY);
+ _events.Repeat(15000, 20000);
+ return;
+ case EVENT_BLIZZARD:
+ DoCastAOE(SPELL_BLIZZARD);
+ _events.Repeat(35000, 45000);
+ return;
+ default:
+ break;
+ }
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+ }
+
+ // no melee attack
+ }
+
+ private:
+ EventMap _events;
+ InstanceScript* _instance;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetUlduarAI<npc_sifAI>(creature);
+ }
+};
+
+// 62576 - Blizzard
+// 62602 - Blizzard
+class spell_thorim_blizzard_effect : public SpellScriptLoader
+{
+ public:
+ spell_thorim_blizzard_effect() : SpellScriptLoader("spell_thorim_blizzard_effect") { }
+
+ class spell_thorim_blizzard_effect_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_thorim_blizzard_effect_AuraScript);
+
+ bool CheckAreaTarget(Unit* target)
+ {
+ /// @todo: fix this for all dynobj auras
+ if (target != GetOwner())
+ {
+ // check if not stacking aura already on target
+ // this one prevents overriding auras periodically by 2 near area aura owners
+ Unit::AuraApplicationMap const& auraMap = target->GetAppliedAuras();
+ for (Unit::AuraApplicationMap::const_iterator iter = auraMap.begin(); iter != auraMap.end(); ++iter)
+ {
+ Aura const* aura = iter->second->GetBase();
+ if (GetId() == aura->GetId() && GetOwner() != aura->GetOwner() /*!GetAura()->CanStackWith(aura)*/)
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ void Register() override
+ {
+ DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_thorim_blizzard_effect_AuraScript::CheckAreaTarget);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_thorim_blizzard_effect_AuraScript();
+ }
+};
+
+// 62580, 62604 - Frostbolt Volley
+class spell_thorim_frostbolt_volley : public SpellScriptLoader
+{
+ public:
+ spell_thorim_frostbolt_volley() : SpellScriptLoader("spell_thorim_frostbolt_volley") { }
+
+ class spell_thorim_frostbolt_volley_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_thorim_frostbolt_volley_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& unitList)
+ {
+ unitList.remove_if([](WorldObject* target)
+ {
+ return target->GetTypeId() != TYPEID_PLAYER && (target->GetTypeId() != TYPEID_UNIT || !target->ToUnit()->IsPet());
+ });
+ }
+
+ void Register() override
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thorim_frostbolt_volley_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_thorim_frostbolt_volley_SpellScript();
+ }
+};
+
+// 62016 - Charge Orb
+class spell_thorim_charge_orb : public SpellScriptLoader
+{
+ public:
+ spell_thorim_charge_orb() : SpellScriptLoader("spell_thorim_charge_orb") { }
+
+ class spell_thorim_charge_orb_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_thorim_charge_orb_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_LIGHTNING_PILLAR_1 });
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(HeightPositionCheck(false));
+
+ if (targets.empty())
+ return;
+
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(target);
+ }
+
+ void HandleScript()
+ {
+ if (Unit* target = GetHitUnit())
+ target->CastSpell((Unit*)nullptr, SPELL_LIGHTNING_PILLAR_1, true);
+ }
+
+ void Register() override
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thorim_charge_orb_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ AfterHit += SpellHitFn(spell_thorim_charge_orb_SpellScript::HandleScript);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_thorim_charge_orb_SpellScript();
+ }
+};
+
+// 62466 - Lightning Charge
+class spell_thorim_lightning_charge : public SpellScriptLoader
+{
+ public:
+ spell_thorim_lightning_charge() : SpellScriptLoader("spell_thorim_lightning_charge") { }
+
+ class spell_thorim_lightning_charge_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_thorim_lightning_charge_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_LIGHTNING_CHARGE });
+ }
+
+ void HandleFocus()
+ {
+ /// @workaround: focus target is not working because spell is triggered and instant
+ if (Creature* creature = GetCaster()->ToCreature())
+ creature->FocusTarget(GetSpell(), GetExplTargetWorldObject());
+ }
+
+ void HandleCharge()
+ {
+ GetCaster()->CastSpell(GetCaster(), SPELL_LIGHTNING_CHARGE);
+ }
+
+ void Register() override
+ {
+ BeforeCast += SpellCastFn(spell_thorim_lightning_charge_SpellScript::HandleFocus);
+ AfterCast += SpellCastFn(spell_thorim_lightning_charge_SpellScript::HandleCharge);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_thorim_lightning_charge_SpellScript();
+ }
+};
+
+// 61934 - Leap
+class spell_thorim_arena_leap : public SpellScriptLoader
+{
+ public:
+ spell_thorim_arena_leap() : SpellScriptLoader("spell_thorim_arena_leap") { }
+
+ class spell_thorim_arena_leap_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_thorim_arena_leap_SpellScript);
+
+ bool Load() override
+ {
+ return GetCaster()->GetTypeId() == TYPEID_UNIT;
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Position const* pos = GetHitDest())
+ GetCaster()->ToCreature()->SetHomePosition(*pos);
+ }
+
+ void Register() override
+ {
+ OnEffectLaunch += SpellEffectFn(spell_thorim_arena_leap_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_JUMP_DEST);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_thorim_arena_leap_SpellScript();
+ }
+};
+
+struct OutOfArenaCheck
+{
+ bool operator()(Position const* who) const
+ {
+ return !CreatureAI::IsInBounds(ArenaBoundaries, who);
+ }
+};
+
+// 62042 - Stormhammer
+class spell_thorim_stormhammer : public SpellScriptLoader
+{
+ public:
+ spell_thorim_stormhammer() : SpellScriptLoader("spell_thorim_stormhammer") { }
+
+ class spell_thorim_stormhammer_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_thorim_stormhammer_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo(
+ {
+ SPELL_STORMHAMMER_BOOMERANG,
+ SPELL_DEAFENING_THUNDER
+ });
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if([](WorldObject* target) -> bool { return HeightPositionCheck(true)(target) || OutOfArenaCheck()(target); });
+
+ if (targets.empty())
+ {
+ FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
+ return;
+ }
+
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(target);
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ {
+ target->CastSpell(target, SPELL_DEAFENING_THUNDER, true);
+ target->CastSpell(GetCaster(), SPELL_STORMHAMMER_BOOMERANG, true);
+ }
+ }
+
+ void LoseHammer()
+ {
+ GetCaster()->SetVirtualItem(0, 0);
+ }
+
+ void Register() override
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thorim_stormhammer_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
+ AfterCast += SpellCastFn(spell_thorim_stormhammer_SpellScript::LoseHammer);
+ OnEffectHitTarget += SpellEffectFn(spell_thorim_stormhammer_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_thorim_stormhammer_SpellScript();
+ }
+};
+
+// 64767 - Stormhammer
+class spell_thorim_stormhammer_sif : public SpellScriptLoader
+{
+ public:
+ spell_thorim_stormhammer_sif() : SpellScriptLoader("spell_thorim_stormhammer_sif") { }
+
+ class spell_thorim_stormhammer_sif_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_thorim_stormhammer_sif_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo(
+ {
+ SPELL_STORMHAMMER_BOOMERANG,
+ SPELL_SIF_TRANSFORM
+ });
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ {
+ target->CastSpell(GetCaster(), SPELL_STORMHAMMER_BOOMERANG, true);
+ target->CastSpell(target, SPELL_SIF_TRANSFORM, true);
+ }
+ }
+
+ void LoseHammer()
+ {
+ GetCaster()->SetVirtualItem(0, 0);
+ }
+
+ void Register() override
+ {
+ AfterCast += SpellCastFn(spell_thorim_stormhammer_sif_SpellScript::LoseHammer);
+ OnEffectHitTarget += SpellEffectFn(spell_thorim_stormhammer_sif_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_thorim_stormhammer_sif_SpellScript();
+ }
+};
+
+// 64909 - Stormhammer
+class spell_thorim_stormhammer_boomerang : public SpellScriptLoader
+{
+ public:
+ spell_thorim_stormhammer_boomerang() : SpellScriptLoader("spell_thorim_stormhammer_boomerang") { }
+
+ class spell_thorim_stormhammer_boomerang_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_thorim_stormhammer_boomerang_SpellScript);
+
+ void RecoverHammer(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ target->SetVirtualItem(0, THORIM_WEAPON_DISPLAY_ID);
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_thorim_stormhammer_boomerang_SpellScript::RecoverHammer, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_thorim_stormhammer_boomerang_SpellScript();
+ }
+};
+
+// 62057, 62058 - Runic Smash
+class spell_thorim_runic_smash : public SpellScriptLoader
+{
+ public:
+ spell_thorim_runic_smash() : SpellScriptLoader("spell_thorim_runic_smash") { }
+
+ class spell_thorim_runic_smash_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_thorim_runic_smash_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_RUNIC_SMASH });
+ }
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+
+ std::vector<Creature*> triggers;
+ GetCaster()->GetCreatureListWithEntryInGrid(triggers, GetSpellInfo()->Id == SPELL_RUNIC_SMASH_LEFT ? NPC_GOLEM_LEFT_HAND_BUNNY : NPC_GOLEM_RIGHT_HAND_BUNNY, 150.0f);
+ for (Creature* trigger : triggers)
+ {
+ float dist = GetCaster()->GetExactDist(trigger);
+ trigger->m_Events.AddEvent(new RunicSmashExplosionEvent(trigger), trigger->m_Events.CalculateTime(uint64(dist * 30.f)));
+ };
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_thorim_runic_smash_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_TRIGGER_SPELL);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_thorim_runic_smash_SpellScript();
+ }
+};
+
+class UpperOrbCheck
+{
+ public:
+ UpperOrbCheck() : _check(true) { }
+
+ bool operator() (Creature* target) const
+ {
+ return target->GetEntry() == NPC_THUNDER_ORB && _check(target);
+ }
+
+ private:
+ HeightPositionCheck const _check;
+};
+
+// 62184 - Activate Lightning Orb Periodic
+class spell_thorim_activate_lightning_orb_periodic : public SpellScriptLoader
+{
+ public:
+ spell_thorim_activate_lightning_orb_periodic() : SpellScriptLoader("spell_thorim_activate_lightning_orb_periodic") { }
+
+ class spell_thorim_activate_lightning_orb_periodic_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_thorim_activate_lightning_orb_periodic_AuraScript);
+
+ InstanceScript* instance = nullptr;
+
+ void PeriodicTick(AuraEffect const* /*aurEff*/)
+ {
+ PreventDefaultAction();
+
+ Unit* caster = GetCaster();
+ std::vector<Creature*> triggers;
+
+ UpperOrbCheck check;
+ Trinity::CreatureListSearcher<UpperOrbCheck> searcher(caster, triggers, check);
+ Cell::VisitGridObjects(caster, searcher, 100.f);
+
+ if (!triggers.empty())
+ {
+ Creature* target = Trinity::Containers::SelectRandomContainerElement(triggers);
+ if (Creature* thorim = instance->GetCreature(BOSS_THORIM))
+ thorim->AI()->SetGUID(target->GetGUID(), DATA_CHARGED_PILLAR);
+ }
+ }
+
+ bool Load() override
+ {
+ if (Unit* caster = GetCaster())
+ instance = caster->GetInstanceScript();
+
+ return instance != nullptr;
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_thorim_activate_lightning_orb_periodic_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_thorim_activate_lightning_orb_periodic_AuraScript();
+ }
+};
+
+// 62331, 62418 - Impale
+class spell_iron_ring_guard_impale : public SpellScriptLoader
+{
+ public:
+ spell_iron_ring_guard_impale() : SpellScriptLoader("spell_iron_ring_guard_impale") { }
+
+ class spell_iron_ring_guard_impale_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_iron_ring_guard_impale_AuraScript);
+
+ void PeriodicTick(AuraEffect const* /*aurEff*/)
+ {
+ if (GetTarget()->HealthAbovePct(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()))
+ {
+ Remove(AURA_REMOVE_BY_ENEMY_SPELL);
+ PreventDefaultAction();
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_iron_ring_guard_impale_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_iron_ring_guard_impale_AuraScript();
+ }
+};
+
+class condition_thorim_arena_leap : public ConditionScript
+{
+ public:
+ condition_thorim_arena_leap() : ConditionScript("condition_thorim_arena_leap"), _check(false) { }
+
+ bool OnConditionCheck(Condition const* condition, ConditionSourceInfo& sourceInfo) override
+ {
+ WorldObject* target = sourceInfo.mConditionTargets[condition->ConditionTarget];
+ InstanceScript* instance = target->GetInstanceScript();
+
+ if (!instance)
+ return false;
+
+ return _check(target);
+ }
+
+ private:
+ HeightPositionCheck _check;
+};
+
void AddSC_boss_thorim()
{
new boss_thorim();
+ new npc_thorim_pre_phase();
+ new npc_thorim_arena_phase();
+ new npc_runic_colossus();
+ new npc_ancient_rune_giant();
+ new npc_sif();
+ new spell_thorim_blizzard_effect();
+ new spell_thorim_frostbolt_volley();
+ new spell_thorim_charge_orb();
+ new spell_thorim_lightning_charge();
+ new spell_thorim_stormhammer();
+ new spell_thorim_stormhammer_sif();
+ new spell_thorim_stormhammer_boomerang();
+ new spell_thorim_arena_leap();
+ new spell_thorim_runic_smash();
+ new spell_thorim_activate_lightning_orb_periodic();
+ new spell_iron_ring_guard_impale();
+ new condition_thorim_arena_leap();
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
index 2eb507db98c..be43dc8c6cb 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
@@ -774,7 +774,7 @@ class boss_sara : public CreatureScript
{
me->RemoveAllAuras();
me->SetReactState(REACT_PASSIVE);
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
_events.Reset();
_events.SetPhase(PHASE_ONE);
}
@@ -817,7 +817,7 @@ class boss_sara : public CreatureScript
case EVENT_TRANSFORM_3:
Talk(SAY_SARA_TRANSFORM_4);
DoCast(me, SPELL_FULL_HEAL);
- me->SetFaction(16);
+ me->SetFaction(FACTION_MONSTER_2);
if (Creature* voice = _instance->GetCreature(DATA_VOICE_OF_YOGG_SARON))
voice->AI()->DoAction(ACTION_PHASE_TWO);
if (Creature* mimiron = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MIMIRON_YS)))
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index d34a7ac516c..a90efe7bfd8 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -38,9 +38,9 @@ static BossBoundaryData const boundaries =
{ BOSS_XT002, new RectangleBoundary(755.0f, 940.0f, -125.0f, 95.0f) },
{ BOSS_ASSEMBLY_OF_IRON, new CircleBoundary(Position(1587.2f, 121.0f), 90.0) },
{ BOSS_ALGALON, new CircleBoundary(Position(1632.668f, -307.7656f), 45.0) },
- { BOSS_ALGALON, new ZRangeBoundary(410.0f, 440.0f) },
+ { BOSS_ALGALON, new ZRangeBoundary(410.0f, 470.0f) },
{ BOSS_HODIR, new EllipseBoundary(Position(2001.5f, -240.0f), 50.0, 75.0) },
- { BOSS_THORIM, new CircleBoundary(Position(2134.73f, -263.2f), 50.0) },
+ // Thorim sets boundaries dynamically
{ BOSS_FREYA, new RectangleBoundary(2094.6f, 2520.0f, -250.0f, 200.0f) },
{ BOSS_MIMIRON, new CircleBoundary(Position(2744.0f, 2569.0f), 70.0) },
{ BOSS_VEZAX, new RectangleBoundary(1740.0f, 1930.0f, 31.0f, 228.0f) },
@@ -59,6 +59,11 @@ static DoorData const doorData[] =
{ GO_MIMIRON_DOOR_1, BOSS_MIMIRON, DOOR_TYPE_ROOM },
{ GO_MIMIRON_DOOR_2, BOSS_MIMIRON, DOOR_TYPE_ROOM },
{ GO_MIMIRON_DOOR_3, BOSS_MIMIRON, DOOR_TYPE_ROOM },
+ { GO_THORIM_ENCOUNTER_DOOR, BOSS_THORIM, DOOR_TYPE_ROOM },
+ { GO_ANCIENT_GATE_OF_THE_KEEPERS, BOSS_HODIR, DOOR_TYPE_PASSAGE },
+ { GO_ANCIENT_GATE_OF_THE_KEEPERS, BOSS_MIMIRON, DOOR_TYPE_PASSAGE },
+ { GO_ANCIENT_GATE_OF_THE_KEEPERS, BOSS_THORIM, DOOR_TYPE_PASSAGE },
+ { GO_ANCIENT_GATE_OF_THE_KEEPERS, BOSS_FREYA, DOOR_TYPE_PASSAGE },
{ GO_VEZAX_DOOR, BOSS_VEZAX, DOOR_TYPE_PASSAGE },
{ GO_YOGG_SARON_DOOR, BOSS_YOGG_SARON, DOOR_TYPE_ROOM },
{ GO_DOODAD_UL_SIGILDOOR_03, BOSS_ALGALON, DOOR_TYPE_ROOM },
@@ -95,6 +100,10 @@ ObjectData const creatureData[] =
{ NPC_EXPEDITION_COMMANDER, DATA_EXPEDITION_COMMANDER },
{ NPC_RAZORSCALE_CONTROLLER, DATA_RAZORSCALE_CONTROL },
+ { NPC_SIF, DATA_SIF },
+ { NPC_RUNIC_COLOSSUS, DATA_RUNIC_COLOSSUS },
+ { NPC_RUNE_GIANT, DATA_RUNE_GIANT },
+ { NPC_THORIM_CONTROLLER, DATA_THORIM_CONTROLLER },
{ NPC_COMPUTER, DATA_COMPUTER },
{ NPC_WORLD_TRIGGER_MIMIRON, DATA_MIMIRON_WORLD_TRIGGER },
{ NPC_VOICE_OF_YOGG_SARON, DATA_VOICE_OF_YOGG_SARON },
@@ -118,6 +127,9 @@ ObjectData const objectData[] =
{ GO_RAZOR_HARPOON_2, GO_RAZOR_HARPOON_2 },
{ GO_RAZOR_HARPOON_3, GO_RAZOR_HARPOON_3 },
{ GO_RAZOR_HARPOON_4, GO_RAZOR_HARPOON_4 },
+ { GO_THORIM_LEVER, DATA_THORIM_LEVER },
+ { GO_THORIM_STONE_DOOR, DATA_STONE_DOOR },
+ { GO_THORIM_RUNIC_DOOR, DATA_RUNIC_DOOR },
{ 0, 0 }
};
@@ -173,7 +185,9 @@ class instance_ulduar : public InstanceMapScript
ObjectGuid LeviathanGateGUID;
ObjectGuid KologarnChestGUID;
ObjectGuid KologarnBridgeGUID;
- ObjectGuid ThorimChestGUID;
+ ObjectGuid ThorimDarkIronPortcullisGUID;
+ ObjectGuid CacheOfStormsGUID;
+ ObjectGuid CacheOfStormsHardmodeGUID;
ObjectGuid HodirRareCacheGUID;
ObjectGuid HodirChestGUID;
ObjectGuid MimironTramGUID;
@@ -330,6 +344,16 @@ class instance_ulduar : public InstanceMapScript
creature->UpdateEntry(NPC_BATTLE_PRIEST_GINA);
break;
+ // Thorim
+ case NPC_MERCENARY_CAPTAIN_H:
+ if (TeamInInstance == HORDE)
+ creature->UpdateEntry(NPC_MERCENARY_CAPTAIN_A);
+ break;
+ case NPC_MERCENARY_SOLDIER_H:
+ if (TeamInInstance == HORDE)
+ creature->UpdateEntry(NPC_MERCENARY_SOLDIER_A);
+ break;
+
// Freya
case NPC_IRONBRANCH:
ElderGUIDs[0] = creature->GetGUID();
@@ -447,9 +471,16 @@ class instance_ulduar : public InstanceMapScript
if (GetBossState(BOSS_KOLOGARN) == DONE)
HandleGameObject(ObjectGuid::Empty, false, gameObject);
break;
- case GO_THORIM_CHEST_HERO:
- case GO_THORIM_CHEST:
- ThorimChestGUID = gameObject->GetGUID();
+ case GO_THORIM_DARK_IRON_PORTCULLIS:
+ ThorimDarkIronPortcullisGUID = gameObject->GetGUID();
+ break;
+ case GO_CACHE_OF_STORMS_10:
+ case GO_CACHE_OF_STORMS_25:
+ CacheOfStormsGUID = gameObject->GetGUID();
+ break;
+ case GO_CACHE_OF_STORMS_HARDMODE_10:
+ case GO_CACHE_OF_STORMS_HARDMODE_25:
+ CacheOfStormsHardmodeGUID = gameObject->GetGUID();
break;
case GO_HODIR_RARE_CACHE_OF_WINTER_HERO:
case GO_HODIR_RARE_CACHE_OF_WINTER:
@@ -656,11 +687,25 @@ class instance_ulduar : public InstanceMapScript
case BOSS_THORIM:
if (state == DONE)
{
- if (GameObject* gameObject = instance->GetGameObject(ThorimChestGUID))
- gameObject->SetRespawnTime(gameObject->GetRespawnDelay());
+ if (Creature* thorim = GetCreature(BOSS_THORIM))
+ {
+ if (GameObject* cache = instance->GetGameObject(thorim->AI()->GetData(DATA_THORIM_HARDMODE) ? CacheOfStormsHardmodeGUID : CacheOfStormsGUID))
+ {
+ cache->SetLootRecipient(thorim->GetLootRecipient());
+ cache->SetRespawnTime(cache->GetRespawnDelay());
+ cache->RemoveFlag(GO_FLAG_LOCKED);
+ cache->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
+ cache->RemoveFlag(GO_FLAG_NODESPAWN);
+ }
+ }
instance->SummonCreature(NPC_THORIM_OBSERVATION_RING, ObservationRingKeepersPos[2]);
}
+ else
+ {
+ DoCloseDoorOrButton(GetGuidData(DATA_THORIM_LEVER));
+ DoCloseDoorOrButton(ThorimDarkIronPortcullisGUID);
+ }
break;
case BOSS_ALGALON:
if (state == DONE)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index a26b699b396..885686e6fc6 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -157,6 +157,31 @@ enum UlduarNPCs
// Freya Achievement Trigger
NPC_FREYA_ACHIEVE_TRIGGER = 33406,
+ // Thorim
+ NPC_THORIM_INVISIBLE_STALKER = 32780,
+ NPC_JORMUNGAR_BEHEMOTH = 32882,
+ NPC_MERCENARY_CAPTAIN_A = 32908,
+ NPC_MERCENARY_CAPTAIN_H = 32907,
+ NPC_MERCENARY_SOLDIER_A = 32885,
+ NPC_MERCENARY_SOLDIER_H = 32883,
+ NPC_DARK_RUNE_ACOLYTE_PRE = 32886,
+ NPC_RUNIC_COLOSSUS = 32872,
+ NPC_RUNE_GIANT = 32873,
+ NPC_IRON_RING_GUARD = 32874,
+ NPC_IRON_HONOR_GUARD = 32875,
+ NPC_DARK_RUNE_CHAMPION = 32876,
+ NPC_DARK_RUNE_WARBRINGER = 32877,
+ NPC_DARK_RUNE_EVOKER = 32878,
+ NPC_DARK_RUNE_COMMONER = 32904,
+ NPC_DARK_RUNE_ACOLYTE = 33110,
+ NPC_THORIM_EVENT_BUNNY = 32892,
+ NPC_LIGHTNING_ORB = 33138,
+ NPC_GOLEM_RIGHT_HAND_BUNNY = 33140,
+ NPC_GOLEM_LEFT_HAND_BUNNY = 33141,
+ NPC_SIF = 33196,
+ NPC_THUNDER_ORB = 33378,
+ NPC_THORIM_CONTROLLER = 32879,
+
// Yogg-Saron
NPC_SARA = 33134,
NPC_GUARDIAN_OF_YOGG_SARON = 33136,
@@ -231,6 +256,8 @@ enum UlduarGameObjects
GO_KOLOGARN_BRIDGE = 194232,
GO_KOLOGARN_DOOR = 194553,
+ GO_ANCIENT_GATE_OF_THE_KEEPERS = 194255,
+
// Hodir
GO_HODIR_ENTRANCE = 194442,
GO_HODIR_DOOR = 194634,
@@ -241,8 +268,15 @@ enum UlduarGameObjects
GO_HODIR_CHEST = 194307,
// Thorim
- GO_THORIM_CHEST_HERO = 194315,
- GO_THORIM_CHEST = 194314,
+ GO_CACHE_OF_STORMS_10 = 194312,
+ GO_CACHE_OF_STORMS_HARDMODE_10 = 194313,
+ GO_CACHE_OF_STORMS_25 = 194315,
+ GO_CACHE_OF_STORMS_HARDMODE_25 = 194314,
+ GO_THORIM_RUNIC_DOOR = 194557,
+ GO_THORIM_STONE_DOOR = 194558,
+ GO_THORIM_ENCOUNTER_DOOR = 194559,
+ GO_THORIM_LEVER = 194264,
+ GO_THORIM_DARK_IRON_PORTCULLIS = 194560,
// Mimiron
GO_MIMIRON_TRAM = 194675,
@@ -407,6 +441,16 @@ enum UlduarData
DATA_ALGALON_TRAPDOOR,
DATA_BRANN_BRONZEBEARD_ALG,
+ // Thorim
+ DATA_SIF,
+ DATA_THORIM_LEVER,
+ DATA_RUNIC_COLOSSUS,
+ DATA_RUNE_GIANT,
+ DATA_RUNIC_DOOR,
+ DATA_STONE_DOOR,
+ DATA_THORIM_HARDMODE,
+ DATA_THORIM_CONTROLLER,
+
// Misc
DATA_BRANN_BRONZEBEARD_INTRO,
DATA_LORE_KEEPER_OF_NORGANNON,
@@ -423,10 +467,15 @@ enum UlduarWorldStates
enum UlduarAchievementData
{
// FL Achievement boolean
- DATA_UNBROKEN = 29052906, // 2905, 2906 are achievement IDs,
+ DATA_UNBROKEN = 29052906, // 2905, 2906 are achievement IDs,
MAX_HERALD_ARMOR_ITEMLEVEL = 226,
- MAX_HERALD_WEAPON_ITEMLEVEL = 232,
- SPELL_LUMBERJACKED_CREDIT = 65296
+ MAX_HERALD_WEAPON_ITEMLEVEL = 232
+};
+
+enum UlduarSharedSpells
+{
+ SPELL_LUMBERJACKED_CREDIT = 65296,
+ SPELL_TELEPORT_KEEPER_VISUAL = 62940 // used by keepers
};
enum UlduarEvents
@@ -445,6 +494,23 @@ enum YoggSaronIllusions
STORMWIND_ILLUSION = 2,
};
+class KeeperDespawnEvent : public BasicEvent
+{
+public:
+ KeeperDespawnEvent(Creature* owner, uint32 despawnTimerOffset = 500) : _owner(owner), _despawnTimer(despawnTimerOffset) { }
+
+ bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override
+ {
+ _owner->CastSpell(_owner, SPELL_TELEPORT_KEEPER_VISUAL);
+ _owner->DespawnOrUnsummon(1000 + _despawnTimer);
+ return true;
+ }
+
+private:
+ Creature* _owner;
+ uint32 _despawnTimer;
+};
+
template<typename AI, typename T>
inline AI* GetUlduarAI(T* obj)
{
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
index 5b9ab19fb86..ae9d06e9e5d 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
@@ -277,7 +277,7 @@ class npc_frozen_orb_stalker : public CreatureScript
{
Position pos;
me->GetNearPoint(toravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f);
- me->SetPosition(pos);
+ me->UpdatePosition(pos);
DoCast(me, SPELL_FROZEN_ORB_SUMMON);
}
}
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index 042b8dad906..8d7231d2ea3 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -243,7 +243,7 @@ class npc_ichor_globule : public CreatureScript
struct npc_ichor_globuleAI : public ScriptedAI
{
- npc_ichor_globuleAI(Creature* creature) : ScriptedAI(creature)
+ npc_ichor_globuleAI(Creature* creature) : ScriptedAI(creature), _splashTriggered(false)
{
_instance = creature->GetInstanceScript();
creature->SetReactState(REACT_PASSIVE);
@@ -275,14 +275,21 @@ class npc_ichor_globule : public CreatureScript
// this feature should be still implemented
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
+ if (_splashTriggered)
+ return;
+
if (damage >= me->GetHealth())
+ {
+ _splashTriggered = true;
DoCastAOE(SPELL_SPLASH);
+ }
}
void UpdateAI(uint32 /*diff*/) override { }
private:
InstanceScript* _instance;
+ bool _splashTriggered;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Northrend/northrend_script_loader.cpp b/src/server/scripts/Northrend/northrend_script_loader.cpp
index 934d29e61b6..57bd641591c 100644
--- a/src/server/scripts/Northrend/northrend_script_loader.cpp
+++ b/src/server/scripts/Northrend/northrend_script_loader.cpp
@@ -110,6 +110,7 @@ void AddSC_boss_general_vezax();
void AddSC_boss_mimiron();
void AddSC_boss_hodir();
void AddSC_boss_freya();
+void AddSC_boss_thorim();
void AddSC_boss_yogg_saron();
void AddSC_boss_algalon_the_observer();
void AddSC_instance_ulduar();
@@ -291,6 +292,7 @@ void AddNorthrendScripts()
AddSC_boss_mimiron();
AddSC_boss_hodir();
AddSC_boss_freya();
+ AddSC_boss_thorim();
AddSC_boss_yogg_saron();
AddSC_boss_algalon_the_observer();
AddSC_instance_ulduar();
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp
index b14038431ad..b487d7fc6e1 100644
--- a/src/server/scripts/Northrend/zone_borean_tundra.cpp
+++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp
@@ -119,7 +119,7 @@ public:
DoCast(me, SPELL_EXPLODE_CART, true);
DoCast(me, SPELL_SUMMON_CART, true);
if (GameObject* cart = me->FindNearestGameObject(GO_EXPLOSIVES_CART, 3.0f))
- cart->SetFaction(14);
+ cart->SetFaction(FACTION_MONSTER);
phaseTimer = 3000;
phase = 2;
break;
@@ -557,9 +557,6 @@ enum Lurgglbr
GO_CAGE = 187369,
- FACTION_ESCORTEE_A = 774,
- FACTION_ESCORTEE_H = 775,
-
SAY_START_1 = 0,
SAY_START_2 = 1,
SAY_END_1 = 2,
@@ -681,11 +678,11 @@ public:
switch (player->GetTeam())
{
case ALLIANCE:
- me->SetFaction(FACTION_ESCORTEE_A);
+ me->SetFaction(FACTION_ESCORTEE_A_PASSIVE);
break;
default:
case HORDE:
- me->SetFaction(FACTION_ESCORTEE_H);
+ me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
break;
}
}
@@ -1690,10 +1687,10 @@ public:
switch (player->GetTeam())
{
case ALLIANCE:
- me->SetFaction(FACTION_ESCORTEE_A);
+ me->SetFaction(FACTION_ESCORTEE_A_PASSIVE);
break;
case HORDE:
- me->SetFaction(FACTION_ESCORTEE_H);
+ me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
break;
}
me->SetStandState(UNIT_STAND_STATE_STAND);
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp
index 5c7df86b6a4..9c3f455bc41 100644
--- a/src/server/scripts/Northrend/zone_dragonblight.cpp
+++ b/src/server/scripts/Northrend/zone_dragonblight.cpp
@@ -379,9 +379,7 @@ enum StrengthenAncientsMisc
SPELL_CREATE_ITEM_BARK = 47550,
SPELL_CONFUSED = 47044,
- NPC_LOTHALOR = 26321,
-
- FACTION_WALKER_ENEMY = 14,
+ NPC_LOTHALOR = 26321
};
class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker
@@ -414,7 +412,7 @@ public:
else if (roll == 0) // enemy version
{
tree->AI()->Talk(SAY_WALKER_ENEMY, player);
- tree->SetFaction(FACTION_WALKER_ENEMY);
+ tree->SetFaction(FACTION_MONSTER);
tree->Attack(player, true);
}
}
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index d5c06855cff..bfb90373474 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -103,7 +103,7 @@ public:
Talk(SAY_WORGRAGGRO3);
if (Creature* RWORG = me->SummonCreature(NPC_RAVENOUS_WORG, me->GetPositionX()+10, me->GetPositionY()+8, me->GetPositionZ()+2, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000))
{
- RWORG->SetFaction(35);
+ RWORG->SetFaction(FACTION_FRIENDLY);
_RavenousworgGUID = RWORG->GetGUID();
}
break;
@@ -136,7 +136,7 @@ public:
{
RWORG->Kill(Mrfloppy);
Mrfloppy->ExitVehicle();
- RWORG->SetFaction(14);
+ RWORG->SetFaction(FACTION_MONSTER);
RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10, RWORG->GetPositionY()+80, RWORG->GetPositionZ());
Talk(SAY_VICTORY2);
}
diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp
index cab2d03b29c..1989b424679 100644
--- a/src/server/scripts/Northrend/zone_howling_fjord.cpp
+++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp
@@ -43,7 +43,6 @@ EndContentData */
enum Entries
{
NPC_APOTHECARY_HANES = 23784,
- FACTION_ESCORTEE_H = 775,
QUEST_TRAIL_OF_FIRE = 11241,
SPELL_HEALING_POTION = 17534,
@@ -155,7 +154,7 @@ public:
break;
case EVENT_START_ESCORT:
events.Reset();
- me->SetFaction(FACTION_ESCORTEE_H);
+ me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
me->SetReactState(REACT_AGGRESSIVE);
ENSURE_AI(npc_escortAI, (me->AI()))->Start(true, true, _player);
break;
diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp
index 8adbd37d884..bf4caf3128f 100644
--- a/src/server/scripts/Northrend/zone_icecrown.cpp
+++ b/src/server/scripts/Northrend/zone_icecrown.cpp
@@ -47,7 +47,7 @@ public:
{
Initialize();
creature->GetMotionMaster()->MovePoint(0, 8599.258f, 963.951f, 547.553f);
- creature->SetFaction(35); //wrong faction in db?
+ creature->SetFaction(FACTION_FRIENDLY); //wrong faction in db?
}
void Initialize()
@@ -69,7 +69,7 @@ public:
if (uiType != POINT_MOTION_TYPE)
return;
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
}
void DamageTaken(Unit* pDoneBy, uint32& uiDamage) override
@@ -78,7 +78,7 @@ public:
{
uiDamage = 0;
pDoneBy->CastSpell(pDoneBy, SPELL_KILL_CREDIT, true);
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->DespawnOrUnsummon(5000);
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
EnterEvadeMode();
diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
index 01285e18a61..5ace31b5cdd 100644
--- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
@@ -340,7 +340,7 @@ public:
if (quest->GetQuestId() == QUEST_DISASTER)
{
me->GetMotionMaster()->MoveJumpTo(0, 0.4f, 0.4f);
- me->SetFaction(113);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
Start(false, false, player->GetGUID());
Talk(SAY_WP_1);
diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp
index 8fbf23d4a44..5a0e6c5aa99 100644
--- a/src/server/scripts/Northrend/zone_storm_peaks.cpp
+++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp
@@ -93,7 +93,7 @@ public:
if (menuId == GOSSIP_ID && gossipListId == GOSSIP_OPTION_ID)
{
CloseGossipMenuFor(player);
- me->SetFaction(113);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
Start(true, true, player->GetGUID());
}
return false;
diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp
index 48dc7a1d7e4..4e1079eccc7 100644
--- a/src/server/scripts/Northrend/zone_zuldrak.cpp
+++ b/src/server/scripts/Northrend/zone_zuldrak.cpp
@@ -139,7 +139,7 @@ public:
void Reset() override
{
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
DoCast(me, SPELL_KNEEL, true); // Little Hack for kneel - Thanks Illy :P
}
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 56b21a7465f..416eec05c45 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
@@ -192,7 +192,7 @@ class boss_grandmaster_vorpil : public CreatureScript
if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH))
i_pl->TeleportTo(me->GetMapId(), VorpilPosition.GetPositionX(), VorpilPosition.GetPositionY(), VorpilPosition.GetPositionZ(), VorpilPosition.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
- me->SetPosition(VorpilPosition);
+ me->UpdatePosition(VorpilPosition);
DoCast(me, SPELL_DRAW_SHADOWS, true);
DoCast(me, SPELL_RAIN_OF_FIRE);
events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, 6000);
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h
index 2213c65373d..42a6c0457d8 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.h
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.h
@@ -133,7 +133,6 @@ enum BTGameObjectIds
enum BlackTempleMisc
{
- ASHTONGUE_FACTION_FRIEND = 1820,
AKAMA_FACTION_COMBAT = 1868,
AKAMA_INTRO = 1,
AKAMA_FIGHT = 2,
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index 44f9f9069ee..1080e6c1ca9 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -439,7 +439,7 @@ public:
bool operator()(Unit* unit) const
{
- return _me->GetDistance2d(unit) > 25.0f;
+ return unit->GetTypeId() == TYPEID_PLAYER && _me->GetDistance2d(unit) > 25.0f;
}
private:
@@ -2074,7 +2074,8 @@ class spell_illidan_flame_blast : public SpellScriptLoader
void HandleBlaze(SpellEffIndex /*effIndex*/)
{
Unit* target = GetHitUnit();
- target->CastSpell(target, SPELL_BLAZE_SUMMON, true);
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ target->CastSpell(target, SPELL_BLAZE_SUMMON, true);
}
void Register() override
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 279749dfd9f..3d5b3c3f4a4 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -384,7 +384,7 @@ public:
void Reset() override
{
Initialize();
- me->SetFaction(ASHTONGUE_FACTION_FRIEND);
+ me->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
DoCastSelf(SPELL_STEALTH);
if (_instance->GetBossState(DATA_SHADE_OF_AKAMA) != DONE)
@@ -430,7 +430,7 @@ public:
{
_isInCombat = false;
me->CombatStop(true);
- me->SetFaction(ASHTONGUE_FACTION_FRIEND);
+ me->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
me->SetWalk(true);
_events.Reset();
me->GetMotionMaster()->MovePoint(AKAMA_INTRO_WAYPOINT, AkamaWP[1]);
@@ -484,7 +484,7 @@ public:
case EVENT_SHADE_CHANNEL:
me->SetFacingTo(FACE_THE_PLATFORM);
DoCastSelf(SPELL_AKAMA_SOUL_CHANNEL);
- me->SetFaction(AKAMA_FACTION_COMBAT);
+ me->SetFaction(FACTION_MONSTER_SPAR_BUDDY);
_events.ScheduleEvent(EVENT_FIXATE, Seconds(5));
break;
case EVENT_FIXATE:
@@ -532,7 +532,7 @@ public:
}
}
- if (me->GetFaction() == AKAMA_FACTION_COMBAT)
+ if (me->GetFaction() == FACTION_MONSTER_SPAR_BUDDY)
{
if (!UpdateVictim())
return;
@@ -1171,7 +1171,7 @@ public:
Talk(SAY_BROKEN_SPECIAL);
break;
case ACTION_BROKEN_HAIL:
- me->SetFaction(ASHTONGUE_FACTION_FRIEND);
+ me->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
Talk(SAY_BROKEN_HAIL);
break;
case ACTION_BROKEN_EMOTE:
diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
index 21197f01c81..bc2c071f7c3 100644
--- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
@@ -128,7 +128,7 @@ class instance_black_temple : public InstanceMapScript
case NPC_STORM_FURY:
AshtongueGUIDs.emplace_back(creature->GetGUID());
if (GetBossState(DATA_SHADE_OF_AKAMA) == DONE)
- creature->SetFaction(ASHTONGUE_FACTION_FRIEND);
+ creature->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
break;
default:
break;
@@ -175,8 +175,8 @@ class instance_black_temple : public InstanceMapScript
if (state == DONE)
for (ObjectGuid ashtongueGuid : AshtongueGUIDs)
if (Creature* ashtongue = instance->GetCreature(ashtongueGuid))
- ashtongue->SetFaction(ASHTONGUE_FACTION_FRIEND);
- /* fallthrough */
+ ashtongue->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
+ // no break
case DATA_TERON_GOREFIEND:
case DATA_GURTOGG_BLOODBOIL:
case DATA_RELIQUARY_OF_SOULS:
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 a454599bbf7..ba563eb252f 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -753,7 +753,7 @@ public:
void Reset() override
{
me->SetDisableGravity(true);
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
Initialize();
}
@@ -788,7 +788,7 @@ public:
{
if (Creature* trig = me->SummonCreature(TOXIC_SPORES_TRIGGER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000))
{
- trig->SetFaction(14);
+ trig->SetFaction(FACTION_MONSTER);
trig->CastSpell(trig, SPELL_TOXIC_SPORES, true);
}
}
@@ -804,7 +804,7 @@ public:
if (!Vashj || !Vashj->IsAlive() || ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3)
{
// remove
- me->SetFaction(35);
+ me->SetFaction(FACTION_FRIENDLY);
me->DespawnOrUnsummon();
return;
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
index eca80aec5e6..8d2d134d80c 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
@@ -321,7 +321,7 @@ public:
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
}
void EnterCombat(Unit* /*who*/) override { }
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
index 2379950f294..00a911cc53b 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
@@ -662,7 +662,7 @@ public:
InstanceScript* instance;
- bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/)
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
{
ClearGossipMenuFor(player);
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
index 765a7d5a7de..7a04ba358ac 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
@@ -207,7 +207,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
void JustSummoned(Creature* summoned) override
{
- summoned->SetFaction(16);
+ summoned->SetFaction(FACTION_MONSTER_2);
summoned->AddUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
summoned->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index 6fba85f3580..59e48cb078b 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -289,7 +289,7 @@ class boss_alar : public CreatureScript
if (me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f))
dist = 5.0f;
WaitTimer = 1000 + uint32(floor(dist / 80 * 1000.0f));
- me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f);
+ me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f);
me->StopMoving();
WaitEvent = WE_LAND;
return;
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index ee7c9396764..f1a4e6e2d8f 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -291,7 +291,7 @@ class boss_high_astromancer_solarian : public CreatureScript
Phase1_Timer = 50000;
//After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind.
me->GetMotionMaster()->Clear();
- me->SetPosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);
+ me->UpdatePosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);
for (uint8 i=0; i <= 2; ++i)
{
if (!i)
@@ -357,7 +357,7 @@ class boss_high_astromancer_solarian : public CreatureScript
//15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals.
int i = rand32() % 3;
me->GetMotionMaster()->Clear();
- me->SetPosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O);
+ me->UpdatePosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O);
for (int j=0; j <= 2; j++)
if (j != i)
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index ee44f0c0f46..ab5480e8b5f 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -1278,7 +1278,7 @@ class npc_kael_flamestrike : public CreatureScript
Initialize();
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
- me->SetFaction(14);
+ me->SetFaction(FACTION_MONSTER);
}
void MoveInLineOfSight(Unit* /*who*/) override { }
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
index 70b1da72d93..3b4f22bc23c 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
@@ -539,7 +539,7 @@ class npc_zerekethvoidzone : public CreatureScript
void Reset() override
{
me->SetNpcFlags(UNIT_NPC_FLAG_NONE);
- me->SetFaction(16);
+ me->SetFaction(FACTION_MONSTER_2);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_VOID_ZONE_DAMAGE);
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 72001b3a07e..ab8b16468ae 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -46,8 +46,6 @@ enum Aeranas
{
SAY_SUMMON = 0,
SAY_FREE = 1,
- FACTION_HOSTILE = 16,
- FACTION_FRIENDLY = 35,
SPELL_ENVELOPING_WINDS = 15535,
SPELL_SHOCK = 12553
};
@@ -87,7 +85,7 @@ public:
{
if (faction_Timer <= diff)
{
- me->SetFaction(FACTION_HOSTILE);
+ me->SetFaction(FACTION_MONSTER_2);
faction_Timer = 0;
} else faction_Timer -= diff;
}
@@ -252,7 +250,7 @@ enum WoundedBloodElf
QUEST_ROAD_TO_FALCON_WATCH = 9375,
NPC_HAALESHI_WINDWALKER = 16966,
NPC_HAALESHI_TALONGUARD = 16967,
- FACTION_FALCON_WATCH_QUEST = 775
+
};
class npc_wounded_blood_elf : public CreatureScript
@@ -281,7 +279,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
{
- me->SetFaction(FACTION_FALCON_WATCH_QUEST);
+ me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
npc_escortAI::Start(true, false, player->GetGUID());
}
}
@@ -997,7 +995,7 @@ public:
break;
case EVENT_ATTACK:
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
- me->SetFaction(FACTION_HOSTILE);
+ me->SetFaction(FACTION_MONSTER_2);
if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID))
me->CombatStart(player);
_events.ScheduleEvent(EVENT_FIREBALL, 1);
diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp
index c51dfa286ad..55e129504e6 100644
--- a/src/server/scripts/Outland/zone_nagrand.cpp
+++ b/src/server/scripts/Outland/zone_nagrand.cpp
@@ -200,7 +200,7 @@ public:
if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_H)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
- me->SetFaction(232);
+ me->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_ACTIVE);
Start(true, false, player->GetGUID(), quest);
Talk(SAY_MAG_START);
@@ -575,7 +575,7 @@ public:
if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_A)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
- me->SetFaction(231);
+ me->SetFaction(FACTION_ESCORTEE_A_NEUTRAL_ACTIVE);
Start(true, false, player->GetGUID(), quest);
Talk(SAY_KUR_START);
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index c4560a9d633..9ef66707d03 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -548,7 +548,7 @@ public:
{
if (quest->GetQuestId() == Q_ALMABTRIEB)
{
- me->SetFaction(113);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
Start(true, false, player->GetGUID());
}
@@ -656,7 +656,7 @@ public:
{
if (quest->GetQuestId() == QUEST_MARK_V_IS_ALIVE)
{
- me->SetFaction(113);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
Start(false, false, player->GetGUID());
}
}
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index 19b79b6ee4c..a44dedb56ca 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -341,10 +341,6 @@ public:
enum EnshlavedNetherwingDrake
{
- // Factions
- FACTION_DEFAULT = 62,
- FACTION_FRIENDLY = 1840, // Not sure if this is correct, it was taken off of Mordenai.
-
// Spells
SPELL_HIT_FORCE_OF_NELTHARAKU = 38762,
SPELL_FORCE_OF_NELTHARAKU = 38775,
@@ -380,7 +376,7 @@ public:
void Reset() override
{
if (!Tapped)
- me->SetFaction(FACTION_DEFAULT);
+ me->SetFaction(FACTION_ORC_DRAGONMAW);
FlyTimer = 10000;
me->SetDisableGravity(false);
@@ -396,7 +392,7 @@ public:
Tapped = true;
PlayerGUID = caster->GetGUID();
- me->SetFaction(FACTION_FRIENDLY);
+ me->SetFaction(FACTION_FLAYER_HUNTER);
DoCast(caster, SPELL_FORCE_OF_NELTHARAKU, true);
Unit* Dragonmaw = me->FindNearestCreature(NPC_DRAGONMAW_SUBJUGATOR, 50);
@@ -589,8 +585,7 @@ enum Earthmender
SPELL_HEALING_WAVE = 12491,
QUEST_ESCAPE_COILSCAR = 10451,
- NPC_COILSKAR_ASSASSIN = 21044,
- FACTION_EARTHEN = 1726 //guessed
+ NPC_COILSKAR_ASSASSIN = 21044
};
class npc_earthmender_wilda : public CreatureScript
@@ -733,7 +728,7 @@ public:
if (quest->GetQuestId() == QUEST_ESCAPE_COILSCAR)
{
Talk(SAY_WIL_START, player);
- me->SetFaction(FACTION_EARTHEN);
+ me->SetFaction(FACTION_EARTHEN_RING);
Start(false, false, player->GetGUID(), quest);
}
@@ -1415,11 +1410,7 @@ enum Enraged_Dpirits
NPC_CREDIT_EARTH = 21092,
// Captured Spell / Buff
- SPELL_SOUL_CAPTURED = 36115,
-
- // Factions
- FACTION_ENRAGED_SOUL_FRIENDLY = 35,
- FACTION_ENRAGED_SOUL_HOSTILE = 14
+ SPELL_SOUL_CAPTURED = 36115
};
class npc_enraged_spirit : public CreatureScript
@@ -1487,7 +1478,7 @@ public:
totemOspirits = me->FindNearestCreature(ENTRY_TOTEM_OF_SPIRITS, RADIUS_TOTEM_OF_SPIRITS);
if (totemOspirits)
{
- Summoned->SetFaction(FACTION_ENRAGED_SOUL_FRIENDLY);
+ Summoned->SetFaction(FACTION_FRIENDLY);
Summoned->GetMotionMaster()->MovePoint(0, totemOspirits->GetPositionX(), totemOspirits->GetPositionY(), Summoned->GetPositionZ());
if (Unit* owner = totemOspirits->GetOwner())
diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp
index 5334f567a89..60037276c25 100644
--- a/src/server/scripts/Outland/zone_shattrath_city.cpp
+++ b/src/server/scripts/Outland/zone_shattrath_city.cpp
@@ -44,7 +44,6 @@ enum RaliqTheDrunk
{
SAY_RALIQ_ATTACK = 0,
OPTION_ID_COLLECT_A_DEBT = 0,
- FACTION_OGRE_HOSTILE = 45,
MENU_ID_COLLECT_A_DEBT = 7729,
NPC_TEXT_WUT_YOU_WANT = 9440,
CRACKIN_SOME_SKULLS = 10009,
@@ -97,7 +96,7 @@ public:
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
CloseGossipMenuFor(player);
- me->SetFaction(FACTION_OGRE_HOSTILE);
+ me->SetFaction(FACTION_OGRE);
Talk(SAY_RALIQ_ATTACK, player);
AttackStart(player);
}
@@ -134,8 +133,6 @@ enum Salsalabim
{
SAY_DEMONIC_AGGRO = 0,
OPTION_ID_ALTRUIS_SENT_ME = 0,
- FACTION_FRIENDLY = 35,
- FACTION_DEMON_HOSTILE = 90,
MENU_ID_ALTRUIS_SENT_ME = 7725,
NPC_TEXT_SAL_GROWLS_AT_YOU = 9435,
PATIENCE_AND_UNDERSTANDING = 10004,
@@ -198,7 +195,7 @@ public:
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
CloseGossipMenuFor(player);
- me->SetFaction(FACTION_DEMON_HOSTILE);
+ me->SetFaction(FACTION_DEMON);
Talk(SAY_DEMONIC_AGGRO, player);
AttackStart(player);
}
diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp
index 50ee9cf0039..7d519c434a4 100644
--- a/src/server/scripts/Outland/zone_terokkar_forest.cpp
+++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp
@@ -48,8 +48,6 @@ enum UnkorTheRuthless
{
SAY_SUBMIT = 0,
REQUIRED_KILL_COUNT = 10,
- FACTION_FRIENDLY = 35,
- FACTION_HOSTILE = 45,
SPELL_PULVERIZE = 2676,
QUEST_DONTKILLTHEFATONE = 9889,
NPC_BOULDERFIST_INVADER = 18260
@@ -87,7 +85,7 @@ public:
{
Initialize();
me->SetStandState(UNIT_STAND_STATE_STAND);
- me->SetFaction(FACTION_HOSTILE);
+ me->SetFaction(FACTION_OGRE);
}
void EnterCombat(Unit* /*who*/) override { }
@@ -310,7 +308,6 @@ enum Floon
SAY_FLOON_ATTACK = 0,
OPTION_ID_PAY_UP_OR_DIE = 0,
OPTION_ID_COLLECT_A_DEBT = 0,
- FACTION_HOSTILE_FLOON = 1738,
MENU_ID_PAY_UP_OR_DIE = 7731,
MENU_ID_COLLECT_A_DEBT = 7732,
GOSSIP_FLOON_STRANGE_SOUNDS = 9442,
@@ -395,7 +392,7 @@ public:
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
CloseGossipMenuFor(player);
- me->SetFaction(FACTION_HOSTILE_FLOON);
+ me->SetFaction(FACTION_ARAKKOA);
Talk(SAY_FLOON_ATTACK, player);
AttackStart(player);
}
@@ -428,7 +425,6 @@ enum IslaStarmaneData
SAY_PROGRESS_3 = 2,
SAY_PROGRESS_4 = 3,
GO_DISTANCE = 10,
- FACTION_ESCORTEE = 113,
ESCAPE_FROM_FIREWING_POINT_A = 10051,
ESCAPE_FROM_FIREWING_POINT_H = 10052,
SPELL_TRAVEL_FORM_CAT = 32447,
@@ -504,7 +500,7 @@ public:
if (quest->GetQuestId() == ESCAPE_FROM_FIREWING_POINT_H || quest->GetQuestId() == ESCAPE_FROM_FIREWING_POINT_A)
{
Start(true, false, player->GetGUID());
- me->SetFaction(FACTION_ESCORTEE);
+ me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
}
}
};
@@ -694,9 +690,9 @@ public:
Start(false, false, player->GetGUID());
if (player->GetTeamId() == TEAM_ALLIANCE)
- me->SetFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE);
+ me->SetFaction(FACTION_ESCORTEE_A_NEUTRAL_PASSIVE);
else
- me->SetFaction(FACTION_ESCORT_H_NEUTRAL_PASSIVE);
+ me->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_PASSIVE);
}
}
};
diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp
index ced7d46107f..3ff618f4b2d 100644
--- a/src/server/scripts/Outland/zone_zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp
@@ -162,8 +162,7 @@ public:
enum Cooshhooosh
{
SPELL_LIGHTNING_BOLT = 9532,
- QUEST_CRACK_SKULLS = 10009,
- FACTION_HOSTILE_CO = 45
+ QUEST_CRACK_SKULLS = 10009
};
class npc_cooshcoosh : public CreatureScript
@@ -226,7 +225,7 @@ public:
if (action == GOSSIP_ACTION_INFO_DEF)
{
CloseGossipMenuFor(player);
- me->SetFaction(FACTION_HOSTILE_CO);
+ me->SetFaction(FACTION_OGRE);
AttackStart(player);
}
return true;
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 48d63353a34..b0e52234c13 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -66,6 +66,7 @@ enum DruidSpells
SPELL_DRUID_REJUVENATION_T10_PROC = 70691,
SPELL_DRUID_BALANCE_T10_BONUS = 70718,
SPELL_DRUID_BALANCE_T10_BONUS_PROC = 70721,
+ SPELL_DRUID_RESTORATION_T10_2P_BONUS = 70658,
SPELL_DRUID_SUNFIRE_DAMAGE = 164815,
SPELL_DRUID_SURVIVAL_INSTINCTS = 50322
};
@@ -1434,14 +1435,52 @@ public:
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_wild_growth_SpellScript::SetTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY);
}
- private:
std::list<WorldObject*> _targets;
};
+ class spell_dru_wild_growth_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_wild_growth_AuraScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_DRUID_RESTORATION_T10_2P_BONUS });
+ }
+
+ void HandleTickUpdate(AuraEffect* aurEff)
+ {
+ Unit* caster = GetCaster();
+ if (!caster)
+ return;
+
+ // calculate from base damage, not from aurEff->GetAmount() (already modified)
+ float damage = caster->CalculateSpellDamage(GetUnitOwner(), GetSpellInfo(), aurEff->GetEffIndex());
+
+ // Wild Growth = first tick gains a 6% bonus, reduced by 2% each tick
+ float reduction = 2.f;
+ if (AuraEffect* bonus = caster->GetAuraEffect(SPELL_DRUID_RESTORATION_T10_2P_BONUS, EFFECT_0))
+ reduction -= CalculatePct(reduction, bonus->GetAmount());
+ reduction *= (aurEff->GetTickNumber() - 1);
+
+ AddPct(damage, 6.f - reduction);
+ aurEff->SetAmount(int32(damage));
+ }
+
+ void Register() override
+ {
+ OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dru_wild_growth_AuraScript::HandleTickUpdate, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
+ }
+ };
+
SpellScript* GetSpellScript() const override
{
return new spell_dru_wild_growth_SpellScript();
}
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_dru_wild_growth_AuraScript();
+ }
};
void AddSC_druid_spell_scripts()
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 2824a5e637b..de38535a865 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -3704,7 +3704,7 @@ class spell_gen_gm_freeze : public SpellScriptLoader
if (Player* player = GetTarget()->ToPlayer())
{
// stop combat + make player unattackable + duel stop + stop some spells
- player->SetFaction(35);
+ player->SetFaction(FACTION_FRIENDLY);
player->CombatStop();
if (player->IsNonMeleeSpellCast(true))
player->InterruptNonMeleeSpells(true);
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 095933d4c03..60db94dbf63 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -259,8 +259,6 @@ enum ChickenCluck
EMOTE_CLUCK_TEXT = 2,
QUEST_CLUCK = 3861,
- FACTION_FRIENDLY = 35,
- FACTION_CHICKEN = 31
};
class npc_chicken_cluck : public CreatureScript
@@ -285,7 +283,7 @@ public:
void Reset() override
{
Initialize();
- me->SetFaction(FACTION_CHICKEN);
+ me->SetFaction(FACTION_PREY);
me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
}