Skip to content

Commit

Permalink
fix(Scripts/ZulAman): Scout's hut search should ignore the world trig…
Browse files Browse the repository at this point in the history
…ger near Jan'alai (#21113)
  • Loading branch information
sogladev authored Jan 7, 2025
1 parent b373df9 commit cbfeb3e
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,22 +682,6 @@ struct npc_amanishi_tempest : public ScriptedAI
SummonList _summons;
};

struct WorldTriggerHutPred
{
bool operator()(Creature* trigger) const
{
return trigger->GetOrientation() > 2.7f || (trigger->GetOrientation() < 2.7f && 1270.0f < trigger->GetPositionY() && trigger->GetPositionY() < 1280.0f);
}
};

struct WorldTriggerDrumPred
{
bool operator()(Creature* trigger) const
{
return !WorldTriggerHutPred()(trigger);
}
};

enum AmanishiScout
{
NPC_WORLD_TRIGGER = 22515,
Expand All @@ -708,6 +692,18 @@ enum AmanishiScout
SPELL_SHOOT = 16496
};

inline bool IsHut(Creature* trigger)
{
return trigger->GetPositionX() < -90.0f // South of Jan'alai area
&& ((trigger->GetOrientation() > 2.7f) || (trigger->GetOrientation() < 2.7f && 1270.0f < trigger->GetPositionY() && trigger->GetPositionY() < 1280.0f));
}

inline bool IsDrum(Creature* trigger)
{
return trigger->GetPositionX() < -90.0f // South of Jan'alai area
&& !IsHut(trigger);
}

struct npc_amanishi_scout : public ScriptedAI
{
npc_amanishi_scout(Creature* creature) : ScriptedAI(creature) { }
Expand All @@ -725,7 +721,7 @@ struct npc_amanishi_scout : public ScriptedAI
// Move to Drum
std::list<Creature*> triggers;
GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 50.0f);
triggers.remove_if(WorldTriggerHutPred());
triggers.remove_if([](Creature* trigger) {return !IsDrum(trigger);});
triggers.sort(Acore::ObjectDistanceOrderPred(me));
if (!triggers.empty())
{
Expand Down Expand Up @@ -826,7 +822,7 @@ class spell_summon_amanishi_sentries : public SpellScript
{
std::list<Creature*> triggers;
GetCreatureListWithEntryInGrid(triggers, GetHitUnit(), NPC_WORLD_TRIGGER, 50.0f);
triggers.remove_if(WorldTriggerDrumPred());
triggers.remove_if([](Creature* trigger) {return !IsHut(trigger);});
if (triggers.empty())
return;
Creature* trigger = Acore::Containers::SelectRandomContainerElement(triggers);
Expand Down

0 comments on commit cbfeb3e

Please sign in to comment.