Skip to content

Commit

Permalink
Scripts: Implement SCRIPT_FLAG_BUDDY_IS_DESPAWNED for SCRIPT_FLAG_BUD…
Browse files Browse the repository at this point in the history
…DY_BY_STRING_ID
  • Loading branch information
killerwife committed Dec 15, 2023
1 parent 4a04b34 commit 6674950
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/game/DBScripts/ScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1470,13 +1470,17 @@ std::pair<bool, bool> ScriptAction::GetScriptProcessTargets(WorldObject* origina
if ((m_script->data_flags & SCRIPT_FLAG_ALL_ELIGIBLE_BUDDIES) != 0)
{
for (WorldObject* wo : *worldObjects)
buddies.push_back(wo);
if (!wo->IsCreature() || static_cast<Creature*>(wo)->IsAlive() != m_script->IsDeadOrDespawnedBuddy())
buddies.push_back(wo);
}
else
{
WorldObject* closest = nullptr;
for (WorldObject* wo : *worldObjects)
{
if (wo->IsCreature() && static_cast<Creature*>(wo)->IsAlive() == m_script->IsDeadOrDespawnedBuddy())
continue;

if (!closest)
closest = wo;
else if (origin->GetDistance(wo, true, DIST_CALC_NONE) < origin->GetDistance(closest, true, DIST_CALC_NONE))
Expand Down

0 comments on commit 6674950

Please sign in to comment.