[Crash fix] Target IsInWorld check

This commit is contained in:
Yunfan Li
2024-06-04 09:47:40 +08:00
parent 78f35f1b50
commit 55eecba11b
4 changed files with 14 additions and 3 deletions

View File

@@ -63,6 +63,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
return false;
}
if (!target->IsInWorld())
{
return false;
}
std::ostringstream msg;
msg << target->GetName();

View File

@@ -29,7 +29,10 @@ uint8 AoeHealValue::Calculate()
Player* player = ObjectAccessor::FindPlayer(itr->guid);
if (!player || !player->IsAlive())
continue;
if (player->GetDistance(bot) >= sPlayerbotAIConfig->sightDistance)
continue;
float percent = (static_cast<float> (player->GetHealth()) / player->GetMaxHealth()) * 100;
if (percent <= range)
++count;