From 63790adbfea2b9a7665f72ae6b9fe254ce195682 Mon Sep 17 00:00:00 2001 From: Adam B Date: Tue, 11 Apr 2023 15:11:48 -0600 Subject: Add code that changes the faction of Tortheldrin in Dire Maul (#28581) * Add code that changes the faction of Tortheldrin Per WoW Classic, Tortheldrin becomes hostile after Immolthar is killed. This code implements an event that does this. * Bug fix. Fixed a bug where the server would crash if the bosses were already dead and the player zoned in. * Recommited with the correct path. Signed-off-by: Adam Bajac * Removed wrong file. Signed-off-by: Adam Bajac * Made changes requested by jackpoz. Signed-off-by: Adam Bajac * Corrected a syntax error after testing. - Tested in game and confirmed all is working. Signed-off-by: Adam Bajac * Removed whitespace changes. Signed-off-by: Adam Bajac * Changed the script to use OnUnitDeath rather than an event. Signed-off-by: Adam Bajac * Removed the IMMO_DEAD_CHECK event. Signed-off-by: Adam Bajac * Removed redundant comma. Signed-off-by: Adam Bajac --------- Signed-off-by: Adam Bajac Co-authored-by: Adam B --- .../scripts/Kalimdor/DireMaul/instance_dire_maul.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp b/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp index 36fd1c605d7..0dce5d2e81f 100644 --- a/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp +++ b/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp @@ -93,6 +93,9 @@ public: if (GetBossState(DATA_FORCEFIELD) != DONE) creature->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); break; + case NPC_TORTHELDRIN: + _tortheldrinGUID = creature->GetGUID(); + break; default: break; } @@ -147,6 +150,8 @@ public: return _forcefieldGUID; case NPC_IMMOLTHAR: return _immoGUID; + case NPC_TORTHELDRIN: + return _tortheldrinGUID; default: break; } @@ -266,12 +271,22 @@ public: } } + void OnUnitDeath(Unit* unit) override + { + if (unit->GetGUID() == _immoGUID) + { + if (Creature* tortheldrin = instance->GetCreature(_tortheldrinGUID)) + tortheldrin->SetFaction(FACTION_ENEMY); + } + } + protected: EventMap _events; std::array _crystalGUIDs; std::array, 5> _crystalCreatureGUIDs; // 5 different Crystals, maximum of 4 Creatures ObjectGuid _forcefieldGUID; ObjectGuid _immoGUID; + ObjectGuid _tortheldrinGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override -- cgit v1.2.3