From bf5878f8dcf44fe3b5b854c7a220699c4461727b Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:37:32 +0200 Subject: [PATCH] fix(Scripts/SSC): fix issues with Fathomlord and add interactions (#17525) --- .../fathomlord_adds_spawn_to_db.sql | 6 ++ .../boss_fathomlord_karathress.cpp | 59 ++++++++++--------- .../SerpentShrine/instance_serpent_shrine.cpp | 3 + 3 files changed, 40 insertions(+), 28 deletions(-) create mode 100644 data/sql/updates/pending_db_world/fathomlord_adds_spawn_to_db.sql diff --git a/data/sql/updates/pending_db_world/fathomlord_adds_spawn_to_db.sql b/data/sql/updates/pending_db_world/fathomlord_adds_spawn_to_db.sql new file mode 100644 index 000000000..6f133d43c --- /dev/null +++ b/data/sql/updates/pending_db_world/fathomlord_adds_spawn_to_db.sql @@ -0,0 +1,6 @@ +-- +DELETE FROM `creature` WHERE `guid` IN (93763, 93764, 93765); +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`, `CreateObject`, `Comment`) VALUES +(93763, 21964, 0, 0, 548, 0, 0, 1, 1, 0, 463.83, -540.23, -7.54, 3.15, 604800, 0, 0, 603120, 161550, 0, 0, 0, 0, '', 0, 0, NULL), +(93764, 21965, 0, 0, 548, 0, 0, 1, 1, 1, 459.61, -534.81, -7.54, 3.82, 604800, 0, 0, 603120, 161550, 0, 0, 0, 0, '', 0, 0, NULL), +(93765, 21966, 0, 0, 548, 0, 0, 1, 1, 1, 459.94, -547.28, -7.54, 2.42, 604800, 0, 0, 603120, 161550, 0, 0, 0, 0, '', 0, 0, NULL); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 832a11dcf..edd836dd4 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -65,16 +65,13 @@ enum Spells enum Misc { - MAX_ADVISORS = 3, + MAX_ADVISORS = 2, NPC_SEER_OLUM = 22820, GO_CAGE = 185952, }; -const Position advisorsPosition[MAX_ADVISORS + 2] = +const Position advisorsPosition[MAX_ADVISORS] = { - {459.61f, -534.81f, -7.54f, 3.82f}, - {463.83f, -540.23f, -7.54f, 3.15f}, - {459.94f, -547.28f, -7.54f, 2.42f}, {448.37f, -544.71f, -7.54f, 0.00f}, {457.37f, -544.71f, -7.54f, 0.00f} }; @@ -94,21 +91,13 @@ struct boss_fathomlord_karathress : public BossAI BossAI::Reset(); _recentlySpoken = false; - me->SummonCreature(NPC_FATHOM_GUARD_TIDALVESS, advisorsPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); - me->SummonCreature(NPC_FATHOM_GUARD_SHARKKIS, advisorsPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); - me->SummonCreature(NPC_FATHOM_GUARD_CARIBDIS, advisorsPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); - ScheduleHealthCheckEvent(75, [&]{ - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - { - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + instance->DoForAllMinions(DATA_FATHOM_LORD_KARATHRESS, [&](Creature* fathomguard) { + if (fathomguard->IsAlive()) { - if (summon->GetMaxHealth() > 500000) - { - summon->CastSpell(me, SPELL_BLESSING_OF_THE_TIDES, true); - } + fathomguard->CastSpell(me, SPELL_BLESSING_OF_THE_TIDES, true); } - } + }); if (me->HasAura(SPELL_BLESSING_OF_THE_TIDES)) { Talk(SAY_GAIN_BLESSING); @@ -122,19 +111,22 @@ struct boss_fathomlord_karathress : public BossAI if (summon->GetEntry() == NPC_SEER_OLUM) { summon->SetWalk(true); - summon->GetMotionMaster()->MovePoint(0, advisorsPosition[MAX_ADVISORS + 1], false); + summon->GetMotionMaster()->MovePoint(0, advisorsPosition[MAX_ADVISORS - 1], false); } } void SummonedCreatureDies(Creature* summon, Unit*) override { - summons.Despawn(summon); if (summon->GetEntry() == NPC_FATHOM_GUARD_TIDALVESS) Talk(SAY_GAIN_ABILITY1); if (summon->GetEntry() == NPC_FATHOM_GUARD_SHARKKIS) Talk(SAY_GAIN_ABILITY2); if (summon->GetEntry() == NPC_FATHOM_GUARD_CARIBDIS) Talk(SAY_GAIN_ABILITY3); + scheduler.Schedule(1s, [this, summon](TaskContext) + { + summons.Despawn(summon); + }); } void KilledUnit(Unit* /*victim*/) override @@ -154,7 +146,7 @@ struct boss_fathomlord_karathress : public BossAI { Talk(SAY_DEATH); BossAI::JustDied(killer); - me->SummonCreature(NPC_SEER_OLUM, advisorsPosition[MAX_ADVISORS], TEMPSUMMON_TIMED_DESPAWN, 3600000); + me->SummonCreature(NPC_SEER_OLUM, advisorsPosition[MAX_ADVISORS-2], TEMPSUMMON_TIMED_DESPAWN, 3600000); if (GameObject* gobject = me->FindNearestGameObject(GO_CAGE, 100.0f)) { gobject->SetGoState(GO_STATE_ACTIVE); @@ -207,8 +199,6 @@ struct boss_fathomguard_sharkkis : public ScriptedAI { boss_fathomguard_sharkkis(Creature* creature) : ScriptedAI(creature), summons(creature) { - summons.clear(); - _instance = creature->GetInstanceScript(); _scheduler.SetValidator([this] @@ -224,6 +214,7 @@ struct boss_fathomguard_sharkkis : public ScriptedAI _scheduler.CancelAll(); summons.DespawnAll(); + summons.clear(); } void JustSummoned(Creature* summon) override @@ -232,8 +223,12 @@ struct boss_fathomguard_sharkkis : public ScriptedAI summons.Summon(summon); } - void JustEngagedWith(Unit* /*who*/) override + void JustEngagedWith(Unit* who) override { + if (Creature* karathress = _instance->GetCreature(DATA_FATHOM_LORD_KARATHRESS)) + { + karathress->Attack(who, false); + } _scheduler.Schedule(2500ms, [this](TaskContext context) { DoCastRandomTarget(SPELL_HURL_TRIDENT); @@ -268,7 +263,7 @@ struct boss_fathomguard_sharkkis : public ScriptedAI { if (Creature* karathress = _instance->GetCreature(DATA_FATHOM_LORD_KARATHRESS)) { - me->CastSpell(karathress, SPELL_POWER_OF_SHARKKIS); + me->CastSpell(karathress, SPELL_POWER_OF_SHARKKIS, true); } } @@ -416,8 +411,12 @@ struct boss_fathomguard_tidalvess : public ScriptedAI } } - void JustEngagedWith(Unit* /*who*/) override + void JustEngagedWith(Unit* who) override { + if (Creature* karathress = _instance->GetCreature(DATA_FATHOM_LORD_KARATHRESS)) + { + karathress->Attack(who, false); + } _scheduler.Schedule(10900ms, [this](TaskContext context) { DoCastVictim(SPELL_FROST_SHOCK); @@ -439,7 +438,7 @@ struct boss_fathomguard_tidalvess : public ScriptedAI { if (Creature* karathress = _instance->GetCreature(DATA_FATHOM_LORD_KARATHRESS)) { - me->CastSpell(karathress, SPELL_POWER_OF_TIDALVESS); + me->CastSpell(karathress, SPELL_POWER_OF_TIDALVESS, true); } } @@ -489,8 +488,12 @@ struct boss_fathomguard_caribdis : public ScriptedAI summons.Summon(summon); } - void JustEngagedWith(Unit* /*who*/) override + void JustEngagedWith(Unit* who) override { + if (Creature* karathress = _instance->GetCreature(DATA_FATHOM_LORD_KARATHRESS)) + { + karathress->Attack(who, false); + } _scheduler.Schedule(27900ms, [this](TaskContext context) { DoCastSelf(SPELL_WATER_BOLT_VOLLEY); @@ -517,7 +520,7 @@ struct boss_fathomguard_caribdis : public ScriptedAI { if (Creature* karathress = _instance->GetCreature(DATA_FATHOM_LORD_KARATHRESS)) { - me->CastSpell(karathress, SPELL_POWER_OF_CARIBDIS); + me->CastSpell(karathress, SPELL_POWER_OF_CARIBDIS, true); } } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 90d4c5e6c..fdedecd3f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -138,7 +138,10 @@ public: if (Creature* vashj = instance->GetCreature(LadyVashjGUID)) vashj->AI()->JustSummoned(creature); break; + default: + break; } + InstanceScript::OnCreatureCreate(creature); } ObjectGuid GetGuidData(uint32 identifier) const override