diff --git a/data/sql/updates/pending_db_world/rev_1731726839690566900.sql b/data/sql/updates/pending_db_world/rev_1731726839690566900.sql new file mode 100644 index 000000000..2fd4fcc84 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1731726839690566900.sql @@ -0,0 +1,6 @@ +-- +UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 23598; + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 23598) AND (`source_type` = 0) AND (`id` IN (0)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(23598, 0, 0, 0, 0, 0, 100, 0, 7000, 10000, 7000, 10000, 0, 0, 11, 43299, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Dragonhawk Hatchling - In Combat - Cast \'Flame Buffet\''); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index ae7651914..7a192f0c2 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -65,7 +65,6 @@ enum Spells enum Creatures { NPC_AMANI_HATCHER = 23818, - NPC_HATCHLING = 23598, // 42493 NPC_EGG = 23817, NPC_FIRE_BOMB = 23920 }; @@ -153,6 +152,19 @@ struct boss_janalai : public BossAI BossAI::JustDied(killer); } + void JustSummoned(Creature* summon) override + { + if (summon->GetEntry() == NPC_AMANI_HATCHLING) + { + if (summon->GetPositionY() > 1150) + summon->GetMotionMaster()->MovePoint(0, hatcherway[0][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[0][3].GetPositionY()); + else + summon->GetMotionMaster()->MovePoint(0, hatcherway[1][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[1][3].GetPositionY()); + } + + BossAI::JustSummoned(summon); + } + void DamageDealt(Unit* target, uint32& damage, DamageEffectType /*damagetype*/) override { if (_isFlameBreathing) @@ -211,11 +223,7 @@ struct boss_janalai : public BossAI for (Creature* egg : eggList) egg->Respawn(); - std::list hatchlingList; - me->GetCreaturesWithEntryInRange(hatchlingList, 100.0f, NPC_HATCHLING); - for (Creature* hatchling : hatchlingList) - hatchling->DespawnOrUnsummon(); - hatchlingList.clear(); + summons.DespawnEntry(NPC_AMANI_HATCHLING); } else if (hatchAction == HATCH_ALL) DoCastSelf(SPELL_HATCH_EGG_ALL); @@ -390,43 +398,8 @@ private: bool _isHatching; }; -struct npc_janalai_hatchling : public ScriptedAI -{ - npc_janalai_hatchling(Creature* creature) : ScriptedAI(creature) { } - - void Reset() override - { - scheduler.CancelAll(); - if (me->GetPositionY() > 1150) - me->GetMotionMaster()->MovePoint(0, hatcherway[0][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[0][3].GetPositionY()); - else - me->GetMotionMaster()->MovePoint(0, hatcherway[1][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[1][3].GetPositionY()); - - me->SetInCombatWithZone(); - } - - void JustEngagedWith(Unit* who) override - { - ScriptedAI::JustEngagedWith(who); - ScheduleTimedEvent(7s, [&]{ - DoCastVictim(SPELL_FLAMEBUFFET); - }, 10s); - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } -}; - void AddSC_boss_janalai() { RegisterZulAmanCreatureAI(boss_janalai); RegisterZulAmanCreatureAI(npc_janalai_hatcher); - RegisterZulAmanCreatureAI(npc_janalai_hatchling); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index bc2bbbde7..e402fb189 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -58,6 +58,7 @@ DoorData const doorData[] = ObjectData const creatureData[] = { + { NPC_JANALAI, DATA_JANALAI }, { NPC_SPIRIT_LYNX, DATA_SPIRIT_LYNX }, { NPC_HARRISON_JONES, DATA_HARRISON_JONES }, { 0, 0 } @@ -71,6 +72,12 @@ ObjectData const gameObjectData[] = { 0, 0 } }; +ObjectData const summonData[] = +{ + { NPC_AMANI_HATCHLING, DATA_JANALAI }, + { 0, 0 } +}; + BossBoundaryData const boundaries = { { DATA_HEXLORD, new RectangleBoundary(80.50557f, 920.9858f, 155.88986f, 1015.27563f)} @@ -93,6 +100,7 @@ public: LoadObjectData(creatureData, gameObjectData); LoadBossBoundaries(boundaries); LoadDoorData(doorData); + LoadSummonData(summonData); for (uint8 i = 0; i < RAND_VENDOR; ++i) RandVendor[i] = NOT_STARTED; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h index 4da0ed8cd..843198c06 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h @@ -53,7 +53,8 @@ enum CreatureIds NPC_AMANISHI_WARBRINGER = 23580, NPC_AMANISHI_TRIBESMAN = 23582, NPC_AMANISHI_MEDICINE_MAN = 23581, - NPC_AMANISHI_AXE_THROWER = 23542 + NPC_AMANISHI_AXE_THROWER = 23542, + NPC_AMANI_HATCHLING = 23598 // 42493 }; enum GameobjectIds