From f2b3e51c110eaa99cdae39738ea44142f9d0702a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E9=B9=BF?= Date: Fri, 8 Dec 2023 04:22:07 +0800 Subject: [PATCH] fix(scripts/SerpentShrine): #17918 Errors generated (#17939) * Add files via upload * Update boss_lurker_below.cpp * Update instance_serpent_shrine.cpp * Update SerpentShrine.sql * Update SerpentShrine.sql * Update SerpentShrine.sql * Add files via upload * Update instance_serpent_shrine.cpp * Update serpent_shrine.h * Update instance_serpent_shrine.cpp --- .../updates/pending_db_world/SerpentShrine.sql | 17 +++++++++++++++++ .../SerpentShrine/boss_lurker_below.cpp | 11 +++++++---- .../SerpentShrine/instance_serpent_shrine.cpp | 12 ++++++++++-- .../SerpentShrine/serpent_shrine.h | 6 ++++++ 4 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 data/sql/updates/pending_db_world/SerpentShrine.sql diff --git a/data/sql/updates/pending_db_world/SerpentShrine.sql b/data/sql/updates/pending_db_world/SerpentShrine.sql new file mode 100644 index 000000000..ae050f125 --- /dev/null +++ b/data/sql/updates/pending_db_world/SerpentShrine.sql @@ -0,0 +1,17 @@ +SET @CGUID = 153000; +-- 21215 Leotheras the Blind +DELETE FROM `creature_addon` WHERE `guid` = @CGUID+139; +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES +(@CGUID+139, 0, 0, 8, 1, '37546'); + +DELETE FROM `creature_formations` WHERE `leaderGUID` = @CGUID+139; +INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`, `point_1`, `point_2`) VALUES +(@CGUID+139, @CGUID+139, 0, 0, 24, 0, 0), +(@CGUID+139, @CGUID+140, 0, 0, 24, 0, 0), +(@CGUID+139, @CGUID+141, 0, 0, 24, 0, 0), +(@CGUID+139, @CGUID+142, 0, 0, 24, 0, 0); + +-- 21216 Hydross the Unstable +UPDATE `creature` SET `position_x`= -259.13, `position_y`= -356.28, `position_z`= 15.03, `orientation`=6.04 WHERE `guid` = @CGUID+21; +UPDATE `creature` SET `position_x`= -218.8, `position_y`= -371.34, `position_z`= 14.608, `orientation`=2.72 WHERE `guid` = @CGUID+20; +UPDATE `creature` SET `position_x`= -239.43, `position_y`= -363.48, `position_z`= 12, `orientation`=1.19093 WHERE `guid` = @CGUID+19; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 39c5a278f..44e1e5354 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -72,18 +72,21 @@ struct boss_the_lurker_below : public BossAI BossAI::Reset(); me->SetReactState(REACT_PASSIVE); me->SetStandState(UNIT_STAND_STATE_SUBMERGED); - me->SetVisible(false); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); } + void EnterEvadeMode(EvadeReason why) override + { + BossAI::EnterEvadeMode(why); + me->DespawnOrUnsummon(2000); + } + void DoAction(int32 action) override { if (action == ACTION_START_EVENT) { me->SetReactState(REACT_AGGRESSIVE); me->setAttackTimer(BASE_ATTACK, 6000); - me->SetVisible(true); - me->UpdateObjectVisibility(true); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetStandState(UNIT_STAND_STATE_STAND); me->SetInCombatWithZone(); @@ -213,7 +216,7 @@ public: if (roll_chance_i(instance->GetBossState(DATA_THE_LURKER_BELOW) != DONE ? 25 : 0) && !instance->IsEncounterInProgress()) { player->CastSpell(player, SPELL_LURKER_SPAWN_TRIGGER, true); - if (Creature* lurker = ObjectAccessor::GetCreature(*go, instance->GetGuidData(NPC_THE_LURKER_BELOW))) + if (Creature* lurker = go->SummonCreature(NPC_THE_LURKER_BELOW, 40.4058f, -417.108f, -21.5911f, 3.03312f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 604800000)) lurker->AI()->DoAction(ACTION_START_EVENT); return 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 e72c2b538..085db54fb 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -101,8 +101,8 @@ public: { case NPC_COILFANG_SHATTERER: case NPC_COILFANG_PRIESTESS: - if (creature->GetPositionX() > -110.0f && creature->GetPositionX() < 155.0f && creature->GetPositionY() > -610.0f && creature->GetPositionY() < -280.0f) - AliveKeepersCount += creature->IsAlive() ? 0 : -1; // SmartAI calls JUST_RESPAWNED in AIInit... + if (creature->GetPositionX() > 190.0f) + --AliveKeepersCount; break; case NPC_CYCLONE_KARATHRESS: creature->GetMotionMaster()->MoveRandom(50.0f); @@ -126,9 +126,17 @@ public: { case DATA_PLATFORM_KEEPER_RESPAWNED: ++AliveKeepersCount; + if (AliveKeepersCount > MAX_KEEPER_COUNT) + { + AliveKeepersCount = MAX_KEEPER_COUNT; + } break; case DATA_PLATFORM_KEEPER_DIED: --AliveKeepersCount; + if (AliveKeepersCount < MIN_KEEPER_COUNT) + { + AliveKeepersCount = MIN_KEEPER_COUNT; + } break; case DATA_BRIDGE_ACTIVATED: SetBossState(DATA_BRIDGE_EMERGED, NOT_STARTED); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h index 8e10302b9..ec3a318d4 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h @@ -88,6 +88,12 @@ enum SSSpells SPELL_FRENZY_WATER = 37026 }; +enum KeeperCount +{ + MIN_KEEPER_COUNT = 0, + MAX_KEEPER_COUNT = 24 +}; + template inline AI* GetSerpentShrineAI(T* obj) {