diff --git a/data/sql/updates/pending_db_world/rev_1716571588345702920.sql b/data/sql/updates/pending_db_world/rev_1716571588345702920.sql new file mode 100644 index 000000000..b674652f0 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1716571588345702920.sql @@ -0,0 +1,5 @@ +-- +DELETE FROM `creature` WHERE `id1` = 33742; +INSERT INTO `creature` (`guid`, `id1`, `id2`, `id3`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`) VALUES +(136768, 33742, 0, 0, 603, 0, 0, 3, 1, 0, 1809.8663330078125, -38.2449531555175781, 408.03680419921875, 0, 180, 0, 0, 26066, 0, 0, 0, 0, 0, '', 47720); +UPDATE `creature_template` SET `ScriptName` = 'boss_kologarn_pit_kill_bunny' WHERE `entry` = 33742; diff --git a/src/server/game/Maps/AreaBoundary.cpp b/src/server/game/Maps/AreaBoundary.cpp index 3ef5601a8..e5b184876 100644 --- a/src/server/game/Maps/AreaBoundary.cpp +++ b/src/server/game/Maps/AreaBoundary.cpp @@ -110,3 +110,21 @@ bool BoundaryUnionBoundary::IsWithinBoundaryArea(Position const* pos) const { return (_b1->IsWithinBoundary(pos) || _b2->IsWithinBoundary(pos)); } + +// ---== INTERSECT OF 2 BOUNDARIES ==--- +BoundaryIntersectBoundary::BoundaryIntersectBoundary(AreaBoundary const* b1, AreaBoundary const* b2, bool isInverted) : + AreaBoundary(isInverted), _b1(b1), _b2(b2) +{ + ASSERT(b1 && b2); +} + +BoundaryIntersectBoundary::~BoundaryIntersectBoundary() +{ + delete _b1; + delete _b2; +} + +bool BoundaryIntersectBoundary::IsWithinBoundaryArea(Position const* pos) const +{ + return (_b1->IsWithinBoundary(pos) && _b2->IsWithinBoundary(pos)); +} diff --git a/src/server/game/Maps/AreaBoundary.h b/src/server/game/Maps/AreaBoundary.h index e599c335e..48a5e6671 100644 --- a/src/server/game/Maps/AreaBoundary.h +++ b/src/server/game/Maps/AreaBoundary.h @@ -165,4 +165,18 @@ class AC_GAME_API BoundaryUnionBoundary : public AreaBoundary AreaBoundary const* const _b2; }; +class AC_GAME_API BoundaryIntersectBoundary : public AreaBoundary +{ + public: + BoundaryIntersectBoundary(AreaBoundary const* b1, AreaBoundary const* b2, bool isInverted = false); + + protected: + virtual ~BoundaryIntersectBoundary(); + bool IsWithinBoundaryArea(Position const* pos) const override; + + private: + AreaBoundary const* const _b1; + AreaBoundary const* const _b2; +}; + #endif //ACORE_AREA_BOUNDARY_H diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 94e89fa71..56fb1a902 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -665,6 +665,37 @@ public: }; }; +struct boss_kologarn_pit_kill_bunny : public NullCreatureAI +{ + boss_kologarn_pit_kill_bunny(Creature* creature) : NullCreatureAI(creature) { } + + void Reset() override + { + RectangleBoundary* _boundaryXY = new RectangleBoundary(1782.0f, 1832.0f, -56.0f, 8.0f); + ZRangeBoundary* _boundaryZ = new ZRangeBoundary(400.0f, 439.0f); + _boundaryIntersect = new BoundaryIntersectBoundary(_boundaryXY, _boundaryZ); + + scheduler.Schedule(0s, [this](TaskContext context) + { + me->GetMap()->DoForAllPlayers([&](Player* player) + { + if (_boundaryIntersect->IsWithinBoundary(player->GetPosition()) && !player->IsGameMaster()) + { + player->KillSelf(false); + } + }); + context.Repeat(1s); + }); + } + + void UpdateAI(uint32 diff) override + { + scheduler.Update(diff); + } +private: + BoundaryIntersectBoundary const* _boundaryIntersect; +}; + // predicate function to select non main tank target class StoneGripTargetSelector { @@ -894,6 +925,7 @@ void AddSC_boss_kologarn() new boss_kologarn(); new boss_kologarn_arms(); new boss_kologarn_eyebeam(); + RegisterUlduarCreatureAI(boss_kologarn_pit_kill_bunny); // Spells new spell_ulduar_stone_grip_cast_target();