diff --git a/sql/world/base/naxx40.sql b/sql/world/base/naxx40.sql index f3ff0c1..c180e51 100644 --- a/sql/world/base/naxx40.sql +++ b/sql/world/base/naxx40.sql @@ -1,7 +1,20 @@ -# Remove exits - classic Naxx does not allow the player to leave -# Note that this currently affects both Naxx 40 and WotLK Naxx +# Remove exit teleport and replace with script DELETE FROM `areatrigger_teleport` WHERE `ID` IN (5196, 5197, 5198, 5199); +DELETE FROM `areatrigger_scripts` WHERE `entry` IN (5196, 5197, 5198, 5199); +INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES +(5196, 'naxx_exit_trigger'), +(5197, 'naxx_exit_trigger'), +(5198, 'naxx_exit_trigger'), +(5199, 'naxx_exit_trigger'); + +DELETE FROM `areatrigger_scripts` WHERE `entry` IN (5191, 5192, 5193, 5194); +INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES +(5191, 'naxx_northrend_entrance'), +(5192, 'naxx_northrend_entrance'), +(5193, 'naxx_northrend_entrance'), +(5194, 'naxx_northrend_entrance'); + UPDATE `creature` SET `spawnMask` = 3 WHERE `spawnMask` = 7 AND `map` = 533; UPDATE `gameobject` SET `spawnMask` = 7 WHERE `spawnMask` = 3 AND `map` = 533; diff --git a/src/naxx40Scripts/instance_naxxramas.cpp b/src/naxx40Scripts/instance_naxxramas.cpp index f3693b0..0942d79 100644 --- a/src/naxx40Scripts/instance_naxxramas.cpp +++ b/src/naxx40Scripts/instance_naxxramas.cpp @@ -22,6 +22,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "DBCEnums.h" +#include "ObjectMgr.h" #include "naxxramas.h" const float HeiganPos[2] = {2796, -3707}; @@ -1355,10 +1356,77 @@ public: // } }; +class naxx_northrend_entrance : public AreaTriggerScript +{ +public: + naxx_northrend_entrance() : AreaTriggerScript("naxx_northrend_entrance") { } + + bool OnTrigger(Player* player, AreaTrigger const* areaTrigger) override + { + // Do not allow entrance to Naxx 40 from Northrend + // Change 10 man heroic to regular 10 man, as when 10 man heroic is not available + Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(true) : player->GetDifficulty(true); + if (diff == RAID_DIFFICULTY_10MAN_HEROIC) + { + player->SetRaidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL); + } + switch (areaTrigger->entry) + { + // Naxx 10 and 25 entrances + case 5191: + player->TeleportTo(533, 3005.68f, -3447.77f, 293.93f, 4.65f); + break; + case 5192: + player->TeleportTo(533, 3019.34f, -3434.36f, 293.99f, 6.27f); + break; + case 5193: + player->TeleportTo(533, 3005.9f, -3420.58f, 294.11f, 1.58f); + break; + case 5194: + player->TeleportTo(533, 2992.5f, -3434.42f, 293.94f, 3.13f); + break; + } + return true; } +}; + +class naxx_exit_trigger : public AreaTriggerScript +{ +public: + naxx_exit_trigger() : AreaTriggerScript("naxx_exit_trigger") { } + + bool OnTrigger(Player* player, AreaTrigger const* areaTrigger) override + { + if (player->GetMap()->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC) + { + // Naxx 40 cannot be exited via portals, as in Classic + return false; + } + switch (areaTrigger->entry) + { + // Naxx 10 and 25 exits + case 5196: + player->TeleportTo(571, 3679.25f, -1278.58f, 243.55f, 2.39f); + break; + case 5197: + player->TeleportTo(571, 3679.03f, -1259.68f, 243.55f, 3.98f); + break; + case 5198: + player->TeleportTo(571, 3661.14f, -1279.55f, 243.55f, 0.82f); + break; + case 5199: + player->TeleportTo(571, 3660.01f, -1260.99f, 243.55f, 5.51f); + break; + } + return true; + } +}; + void AddSC_instance_naxxramas_combined() { new instance_naxxramas_combined(); new npc_naxx40_area_trigger(); new NaxxPlayerScript(); + new naxx_exit_trigger(); + new naxx_northrend_entrance(); // new boss_naxxramas_misc(); }