Skip to content

Commit 3a57710

Browse files
committed
prepare merge
1 parent 61e9f91 commit 3a57710

2 files changed

Lines changed: 7 additions & 26 deletions

File tree

File renamed without changes.

src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,7 @@ struct boss_janalai : public BossAI
205205

206206
bool AllEggsWereHatched()
207207
{
208-
std::vector<Creature*> eggsVector;
209-
GetCreatureListWithOptionsInGrid(eggsVector, me, 200.0f, { .CreatureId = NPC_DRAGONHAWK_EGG, .IsAlive = true });
210-
if (eggsVector.empty())
211-
return true;
212-
213-
return false;
208+
return GetClosestCreatureWithOptions(me, 200.0f, { .CreatureId = NPC_DRAGONHAWK_EGG, .IsAlive = true }) == nullptr;
214209
}
215210

216211
void DoSummonHatchers()
@@ -362,7 +357,7 @@ struct npc_fire_bomb_zulaman : public ScriptedAI
362357
// 24504 - Amani'shi Hatcher
363358
struct npc_amanishi_hatcher : public ScriptedAI
364359
{
365-
npc_amanishi_hatcher(Creature* creature) : ScriptedAI(creature), _eggsToHatchCount(1) { }
360+
npc_amanishi_hatcher(Creature* creature) : ScriptedAI(creature), _otherHatcherId(0), _eggsToHatchCount(1) { }
366361

367362
void InitializeAI() override
368363
{
@@ -404,31 +399,17 @@ struct npc_amanishi_hatcher : public ScriptedAI
404399

405400
bool AreEggsHatchedA()
406401
{
407-
std::vector<Creature*> eggsVector;
408-
GetCreatureListWithOptionsInGrid(eggsVector, me, 200.0f, { .StringId = _eggsStringIdA, .IsAlive = true });
409-
if (eggsVector.empty())
410-
return true;
411-
412-
return false;
402+
return GetClosestCreatureWithOptions(me, 200.0f, { .StringId = _eggsStringIdA, .IsAlive = true }) == nullptr;
413403
}
414404

415405
bool AreEggsHatchedB()
416406
{
417-
std::vector<Creature*> eggsVector;
418-
GetCreatureListWithOptionsInGrid(eggsVector, me, 200.0f, { .StringId = _eggsStringIdB, .IsAlive = true });
419-
if (eggsVector.empty())
420-
return true;
421-
422-
return false;
407+
return GetClosestCreatureWithOptions(me, 200.0f, { .StringId = _eggsStringIdB, .IsAlive = true }) == nullptr;
423408
}
424409

425410
bool IsOtherHatcherAlive()
426411
{
427-
Creature* hatcher = me->FindNearestCreature(_otherHatcherId, 200.0f, true);
428-
if (hatcher)
429-
return true;
430-
431-
return false;
412+
return me->FindNearestCreature(_otherHatcherId, 200.0f, true) != nullptr;
432413
}
433414

434415
void MovementInform(uint32 type, uint32 id) override
@@ -585,7 +566,7 @@ class spell_janalai_summon_all_players : public SpellScript
585566
void HandleDummy(SpellEffIndex /*effIndex*/)
586567
{
587568
// Guessed value. Patch 2.4.0 (2008-03-25): Will now only teleport players to him if they are too far away.
588-
if (GetCaster()->GetDistance2d(GetHitUnit()) > 30.0f)
569+
if (!GetCaster()->IsWithinDist(GetHitUnit(), 30.0f, false))
589570
GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ALL_PLAYERS_2, true);
590571
}
591572

@@ -641,7 +622,7 @@ class spell_janalai_hatch_eggs : public SpellScript
641622
{
642623
targets.remove_if([caster](WorldObject const* target)
643624
{
644-
return caster->GetDistance(target) > 50.0f;
625+
return !caster->IsWithinDist(target, 50.0f);
645626
});
646627

647628
Trinity::Containers::RandomResize(targets, caster->GetAI()->GetData(DATA_EGGS_TO_HATCH));

0 commit comments

Comments
 (0)